Files
Masto/app/javascript/flavours/glitch/styles/components/search.scss
T
2025-10-17 00:21:14 +02:00

327 lines
5.9 KiB
SCSS

@use "sass:color";
@use "../mixins" as *;
@use "../variables" as *;
.search {
position: relative;
}
.search__icon,
.search__icon.gts-icon {
--size: 20px;
position: absolute;
top: 13px;
left: 13px;
}
.search__input {
@include search-input;
display: block;
padding: 12px 40px;
font-size: 16px;
line-height: 20px;
&::placeholder {
color: var(--color-search-placeholder);
font-weight: 500;
}
&:focus {
color: var(--color-search-fg--focus);
background: var(--color-search-bg--focus);
}
&:focus::placeholder {
color: var(--color-search-placeholder--focus);
}
}
.search__button {
position: absolute;
top: 7px;
right: 7px;
display: none;
padding: 6px;
border: 0;
border-radius: var(--button-border-radius);
color: inherit;
font: inherit;
background: transparent;
transition: all 0.3s;
.gts-icon {
--size: 20px;
display: block;
}
&:focus-visible,
&:hover {
background: color.adjust($ui-base-color, $lightness: -10%);
}
}
.search__button.active {
display: flex;
}
.search__popout {
position: absolute;
display: none;
margin-top: 10px;
padding: 15px 5px;
width: 100%;
border: 1px solid var(--color-lines);
border-radius: var(--drawer-border-radius);
box-sizing: border-box;
background: $ui-base-color;
inset-inline-start: 0;
box-shadow: 4px 4px 6px rgba($base-shadow-color, 0.4);
z-index: 99;
h4 {
text-transform: uppercase;
color: $dark-text-color;
font-weight: 500;
padding: 0 10px;
margin-bottom: 10px;
}
&__menu {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
&__message {
color: $dark-text-color;
padding: 0 10px;
}
&__item {
display: block;
box-sizing: border-box;
width: 100%;
border: 0;
font: inherit;
background: transparent;
color: $darker-text-color;
padding: 10px;
cursor: pointer;
border-radius: 4px;
text-align: start;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&--flex {
display: flex;
justify-content: space-between;
}
.icon-button {
transition: none;
}
&:hover,
&:focus,
&:active,
&.selected {
background: $ui-highlight-color;
color: $primary-text-color;
.icon-button {
color: $primary-text-color;
}
}
mark {
background: transparent;
font-weight: 700;
color: $primary-text-color;
}
span {
overflow: inherit;
text-overflow: inherit;
}
}
}
}
.search.active .search__popout {
display: block;
}
.search-results__header,
.search-results__section__header h3 {
display: flex;
gap: 5px;
align-items: center;
.gts-icon {
--size: 20px;
}
}
.search-results__header {
padding: 15px;
color: $dark-text-color;
font-weight: 500;
font-size: 16px;
background: color.adjust($ui-base-color, $lightness: 2%);
cursor: default;
}
.search-results__info {
padding: 20px;
color: $darker-text-color;
text-align: center;
}
.trends {
&__header {
color: $dark-text-color;
background: color.adjust($ui-base-color, $lightness: 2%);
border-bottom: 1px solid color.adjust($ui-base-color, $lightness: -4%);
font-weight: 500;
padding: 15px;
font-size: 16px;
cursor: default;
.fa {
display: inline-block;
margin-inline-end: 5px;
}
}
&__item {
display: flex;
align-items: center;
padding: 15px;
border-bottom: 1px solid color.adjust($ui-base-color, $lightness: 8%);
gap: 15px;
&:last-child {
border-bottom: 0;
}
&__name {
flex: 1 1 auto;
color: $dark-text-color;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
strong {
font-weight: 500;
}
a {
color: $darker-text-color;
text-decoration: none;
font-size: 14px;
font-weight: 500;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&:hover,
&:focus,
&:active {
span {
text-decoration: underline;
}
}
}
}
&__current {
flex: 0 0 auto;
font-size: 24px;
font-weight: 500;
text-align: end;
color: $secondary-text-color;
text-decoration: none;
}
&__sparkline {
flex: 0 0 auto;
width: 50px;
path:first-child {
fill: rgba($highlight-text-color, 0.25) !important;
fill-opacity: 1 !important;
}
path:last-child {
stroke: color.adjust($highlight-text-color, $lightness: 6%) !important;
fill: none !important;
}
}
&--requires-review {
.trends__item__name {
color: $gold-star;
a {
color: $gold-star;
}
}
.trends__item__current {
color: $gold-star;
}
.trends__item__sparkline {
path:first-child {
fill: rgba($gold-star, 0.25) !important;
}
path:last-child {
stroke: color.adjust($gold-star, $lightness: 6%) !important;
}
}
}
&--disabled {
.trends__item__name {
color: color.adjust($ui-base-color, $lightness: 12%);
a {
color: color.adjust($ui-base-color, $lightness: 12%);
}
}
.trends__item__current {
color: color.adjust($ui-base-color, $lightness: 12%);
}
.trends__item__sparkline {
path:first-child {
fill: rgba(
color.adjust($ui-base-color, $lightness: 12%),
0.25
) !important;
}
path:last-child {
stroke: color.adjust(
color.adjust($ui-base-color, $lightness: 12%),
$lightness: 6%
) !important;
}
}
}
}
&--compact &__item {
padding: 10px;
padding-inline-end: 28px;
}
}