discourse/app/assets/stylesheets/common/components/composer-toggle-switch.scss
Renato Atilio 512a31339a
UX: composer toolbar changes (icon, style, placement) (#32918)
Changes the gear icon for the more menu to a circle-plus icon.

Changes the emoji icon to its outline version, to make it less similar
to the circle-plus icon.

Changes the styles (eg. icon sizes) of the toolbar, using a flexbox
instead of a grid, with some tweaks and animations to the toggle switch,
which occupies a smaller width now.

Removes the gray button-bar bottom border.

Moves the Insert Date/Time item to the more menu, and changes its icon
to a clock.

### Before, hovering more menu

<img width="758" alt="image"
src="https://github.com/user-attachments/assets/84d8f5aa-519e-40a2-ba44-d58d7294f6b0"
/>

### After, hovering more menu

![image](https://github.com/user-attachments/assets/b54eac09-9dd0-4b7f-b93c-82d452cc5ded)

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2025-06-10 12:16:19 -03:00

96 lines
1.9 KiB
SCSS
Vendored

.composer-toggle-switch {
--toggle-switch-width: 40px;
--toggle-switch-height: 24px;
justify-content: center;
display: flex;
align-items: center;
border: 0;
padding: 0;
background: transparent;
&:focus-visible {
outline: none;
}
&[disabled] {
opacity: 0.5;
cursor: not-allowed;
}
&__slider {
display: inline-block;
background: var(--primary-low);
width: var(--toggle-switch-width);
height: var(--toggle-switch-height);
position: relative;
vertical-align: middle;
border-radius: 0.25em;
:focus-visible & {
outline: 2px solid var(--tertiary);
outline-offset: 2px;
}
&::before {
content: "";
display: block;
position: absolute;
background-color: var(--tertiary-low);
width: calc(var(--toggle-switch-height) - 0.125rem);
height: calc(var(--toggle-switch-height) - 0.25rem);
top: 0.125rem;
border-radius: 0.25em;
box-shadow: 0 1px 2px 1px rgb(var(--tertiary-rgb), 0.2);
.--markdown & {
transform: translateX(0.125rem);
}
.--rte & {
transform: translateX(
calc(var(--toggle-switch-width) - var(--toggle-switch-height))
);
}
@media (prefers-reduced-motion: reduce) {
transition-duration: 0ms;
}
}
}
&__left-icon,
&__right-icon {
display: inline-flex;
align-items: center;
justify-content: center;
position: absolute;
opacity: 0;
height: 100%;
width: calc(var(--toggle-switch-height) - 0.125rem);
.d-icon {
color: var(--primary);
vertical-align: text-bottom;
}
@media (prefers-reduced-motion: reduce) {
transition-duration: 0ms;
}
}
&__left-icon {
left: 0.125rem;
.--markdown & {
opacity: 1;
}
}
&__right-icon {
right: 0.125rem;
.--rte & {
opacity: 1;
}
}
}