mediawiki-skins-Citizen/resources/skins.citizen.styles/components/Pagetools.less
2024-05-27 23:00:28 -04:00

297 lines
5.9 KiB
Plaintext

.page-actions {
display: flex;
gap: var( --space-xxs );
align-items: center;
// TODO: Merge this with header__item
&__item {
display: flex;
}
// TODO: Merge this with header__button
&__button {
display: grid;
place-items: center;
width: 2.5rem; // Same width as other buttons
height: 2.25rem; // Same height as other buttons
border-radius: var( --border-radius--medium );
&:hover {
background-color: var( --background-color-quiet--hover );
.citizen-ui-icon::before {
opacity: var( --opacity-icon-base--hover );
}
}
&:active {
background-color: var( --background-color-quiet--active );
.citizen-ui-icon::before {
opacity: var( --opacity-icon-base--active );
}
}
}
&__card {
position: absolute;
top: 100%;
right: ~'calc( var( --space-xs ) * -1 )'; // counteract margin
z-index: @z-index-page-header; // So the popups inside will be higher than content
display: grid;
gap: var( --space-xs );
max-height: 60vh;
padding: var( --space-xs ) 0;
transform-origin: var( --transform-origin-offset-end ) var( --transform-origin-offset-end );
@media ( min-width: @min-width-breakpoint-desktop ) {
transform-origin: var( --transform-origin-offset-end ) var( --transform-origin-offset-start );
}
}
// Visible page tools styles
> .mw-portlet {
ul {
display: flex;
gap: var( --space-xxs );
}
li > a {
gap: 0;
padding-right: var( --space-sm );
padding-left: var( --space-sm );
font-size: 0;
border-radius: var( --border-radius--medium );
&:hover {
background-color: var( --background-color-quiet--hover );
}
&:active {
background-color: var( --background-color-quiet--active );
}
}
}
li {
margin: 0;
}
// TODO: Merge this with header styles
.citizen-menu-checkbox-checkbox:checked ~ .page-actions__button {
background-color: var( --background-color-primary--active );
}
// Hide menu labels
> .citizen-menu > .citizen-menu__heading {
.mixin-screen-reader-text;
}
}
// Language counter badge
// TODO: Maybe this should be in a mixin
#citizen-languages__buttonCheckbox {
position: relative; // So that the badge doesn't take a stroll to the far left
&::after {
position: absolute;
top: 0;
right: 0;
display: block;
padding: 0.1em 0.4em;
font-size: 0.65rem;
color: #fff;
content: attr( data-counter-text );
background: var( --color-primary );
border-radius: var( --border-radius--pill );
}
}
.citizen-languages {
// Special handling for ULS
// ULS won't be triggered by the label button
// so we need to overlay the checkbox on top of it
.mw-interlanguage-selector {
position: absolute;
z-index: 1;
display: block;
width: var( --size-button--page );
height: var( --size-button--page );
padding: 0;
margin: 0;
cursor: pointer;
opacity: 0;
// Hover state needs to be define because the checkbox now overlays the label
&:hover {
~ .page-actions__button {
background-color: var( --background-color-quiet--hover );
.citizen-ui-icon::before {
opacity: var( --opacity-icon-base--hover );
}
}
}
&:active {
~ .page-actions__button {
background-color: var( --background-color-quiet--active );
.citizen-ui-icon::before {
opacity: var( --opacity-icon-base--active );
}
}
}
}
}
.page-actions-more,
.citizen-languages {
position: relative;
}
// Edit button
#ca-edit,
#ca-ve-edit {
> a {
color: #fff;
background-color: var( --color-primary );
&:hover {
background-color: var( --color-primary--hover );
}
&:active {
background-color: var( --color-primary--active );
}
}
.citizen-ui-icon {
&::before {
filter: invert( 1 );
// white icon
opacity: 1;
}
}
}
// VE styles shouldn't be core but it is just a few lines :/
#ca-ve-edit {
order: 98; // Before source edit
}
#ca-edit {
order: 99; // Align to last
}
// Merge two buttons together
.client-js .citizen-ve-edit-merged {
&#ca-ve-edit {
> a {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
&#ca-edit {
margin-left: ~'calc( var( --space-xxs ) * -1 )';
border-left: 1px solid var( --color-primary--hover );
> a {
gap: 0;
font-size: 0; // hide edit source text
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
}
// Checkbox hack
#citizen-languages {
&__checkbox:checked {
~ .page-actions__card {
.citizen-card-show();
}
}
}
// To avoid more menu from overflow in narrow screen
@media ( max-width: @max-width-breakpoint-tablet ) {
.page-actions {
position: fixed;
right: 0;
bottom: ~'calc( var( --header-size ) + var( --space-xs ) )';
height: var( --toolbar-size );
margin: var( --space-xs );
background: var( --color-surface-1 );
border-radius: var( --border-radius--medium );
box-shadow: var( --box-shadow-dialog );
.citizen-scroll--down & {
visibility: hidden;
box-shadow: none;
opacity: 0;
transform: translateY( 250% );
}
.citizen-scroll--up & {
// Only apply transition on showing because of flickering issue
visibility: visible;
opacity: 1;
transition: var( --transition-menu );
transition-delay: 250ms;
transition-property: opacity, visibility, transform;
}
:not( .page-actions__card ) .mw-list-item {
--size-icon: 1rem;
}
> .mw-portlet li > a {
height: var( --toolbar-size );
}
&__item {
position: unset;
}
&__card {
top: unset;
bottom: 100%;
.citizen-card-hide( bottom right );
}
}
}
@media ( min-width: @min-width-breakpoint-desktop ) {
.page-actions {
> .mw-portlet {
li > a {
gap: var( --space-xs );
font-size: var( --font-size-small );
}
}
&__card {
// Expand the width on narrow screens might overflow the page
white-space: nowrap;
}
}
}
// Reset hover styles if it is a touch device
// This is dumb but hover:hover overrides active states
@media ( hover: none ) {
.page-actions {
&__button {
&:hover {
background-color: none;
.citizen-ui-icon::before {
opacity: var( --opacity-icon-base );
}
}
}
}
}