chore: adjusts admin UI styling (#7557)

## Description

- Improves mobile styling of Payload admin UI.
- Reduces font size on dashboard cards.
- Improves the block/collapsible/array field styling.

- [x] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

<!-- Please delete options that are not relevant. -->

- [x] Chore (non-breaking change which does not add functionality)

## Checklist:

- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] Existing test suite passes locally with my changes
- [ ] I have made corresponding changes to the documentation
This commit is contained in:
Tylan Davis
2024-08-09 11:19:36 -04:00
committed by GitHub
parent 69ada97df5
commit 0d552fd523
39 changed files with 142 additions and 96 deletions

View File

@@ -37,7 +37,6 @@
&__tabs { &__tabs {
padding: 0; padding: 0;
margin-left: var(--gutter-h);
} }
} }

View File

@@ -40,8 +40,6 @@
&__title { &__title {
width: 100%; width: 100%;
padding-left: var(--gutter-h);
padding-right: var(--gutter-h);
} }
} }

View File

@@ -13,6 +13,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--base); gap: var(--base);
padding: base(2);
} }
&__content { &__content {

View File

@@ -98,11 +98,7 @@ export const DefaultNavClient: React.FC = () => {
key={i} key={i}
tabIndex={!navOpen ? -1 : undefined} tabIndex={!navOpen ? -1 : undefined}
> >
{activeCollection && ( {activeCollection && <div className={`${baseClass}__link-indicator`} />}
<span className={`${baseClass}__link-icon`}>
<ChevronIcon direction="right" />
</span>
)}
<span className={`${baseClass}__link-label`}>{entityLabel}</span> <span className={`${baseClass}__link-label`}>{entityLabel}</span>
</LinkElement> </LinkElement>
) )

View File

@@ -10,6 +10,7 @@
border-right: 1px solid var(--theme-elevation-100); border-right: 1px solid var(--theme-elevation-100);
opacity: 0; opacity: 0;
transition: opacity var(--nav-trans-time) ease-in-out; transition: opacity var(--nav-trans-time) ease-in-out;
overflow: hidden;
&--nav-open { &--nav-open {
opacity: 1; opacity: 1;
@@ -18,7 +19,7 @@
&__header { &__header {
position: absolute; position: absolute;
top: 0; top: 0;
width: 100%; width: 100vw;
height: var(--app-header-height); height: var(--app-header-height);
} }
@@ -26,6 +27,7 @@
z-index: 1; z-index: 1;
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%;
} }
&__mobile-close { &__mobile-close {
@@ -33,7 +35,7 @@
background: none; background: none;
border: 0; border: 0;
outline: 0; outline: 0;
padding: calc(var(--base) * 0.75) var(--gutter-h); padding: base(0.8) 0;
} }
&__scroll { &__scroll {
@@ -85,7 +87,9 @@
nav { nav {
a { a {
position: relative; position: relative;
padding: base(0.125) base(1.5) base(0.125) 0; padding-block: base(0.125);
padding-inline-start: 0;
padding-inline-end: base(1.5);
display: flex; display: flex;
text-decoration: none; text-decoration: none;
@@ -112,10 +116,16 @@
align-items: center; align-items: center;
} }
&__link-icon { &__link-indicator {
margin-right: calc(var(--base) * 0.25); position: absolute;
top: -1px; display: block;
position: relative; // top: 0;
inset-inline-start: base(-1);
width: 2px;
height: 16px;
border-start-end-radius: 2px;
border-end-end-radius: 2px;
background: var(--theme-text);
} }
@include mid-break { @include mid-break {

View File

@@ -38,19 +38,19 @@
--gutter-h: #{base(3)}; --gutter-h: #{base(3)};
--spacing-view-bottom: var(--gutter-h); --spacing-view-bottom: var(--gutter-h);
--app-header-height: calc(var(--base) * 3); --doc-controls-height: calc(var(--base) * 2.8);
--doc-controls-height: calc(var(--base) * 3); --app-header-height: calc(var(--base) * 2.8);
--nav-width: 275px; --nav-width: 275px;
--nav-trans-time: 150ms; --nav-trans-time: 150ms;
@include mid-break { @include mid-break {
--gutter-h: #{base(2)}; --gutter-h: #{base(2)};
--app-header-height: calc(var(--base) * 2); --app-header-height: calc(var(--base) * 2.4);
--doc-controls-height: calc(var(--base) * 2.5); --doc-controls-height: calc(var(--base) * 2.4);
} }
@include small-break { @include small-break {
--gutter-h: #{base(0.5)}; --gutter-h: #{base(0.8)};
--spacing-view-bottom: calc(var(--base) * 2); --spacing-view-bottom: calc(var(--base) * 2);
--nav-width: 100vw; --nav-width: 100vw;
} }

View File

@@ -96,6 +96,7 @@
font-size: $baseline-body-size; font-size: $baseline-body-size;
line-height: $baseline-px; line-height: $baseline-px;
font-weight: normal; font-weight: normal;
font-family: var(--font-body);
} }
%code { %code {

View File

@@ -111,8 +111,7 @@
position: relative; position: relative;
width: 100%; width: 100%;
top: 0; top: 0;
padding-right: var(--gutter-h); padding-inline-end: var(--gutter-h);
padding-left: var(--gutter-h);
} }
} }
} }

View File

@@ -15,7 +15,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: base(0.75); gap: base(0.8);
h1 { h1 {
margin: 0; margin: 0;
@@ -95,18 +95,18 @@
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: 10; z-index: 10;
padding: base(0.75) 0; padding: base(0.8) 0;
width: 100%; width: 100%;
background-color: var(--theme-bg); background-color: var(--theme-bg);
.btn { .btn {
margin: 0 0 0 base(0.5); margin: 0 0 0 base(0.4);
} }
.btn { .btn {
background-color: var(--theme-elevation-100); background-color: var(--theme-elevation-100);
cursor: pointer; cursor: pointer;
padding: 0 base(0.25); padding: 0 base(0.4);
border-radius: $style-radius-s; border-radius: $style-radius-s;
&:hover { &:hover {
@@ -180,13 +180,6 @@
} }
@include small-break { @include small-break {
margin-top: 0; margin-bottom: base(2.4);
margin-bottom: base(3);
&__header {
.pill {
top: -6px;
}
}
} }
} }

View File

@@ -9,9 +9,13 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: calc(var(--base) / 2); gap: calc(var(--base) / 2);
font-family: var( @extend %body;
--font-body
); // Reset font to non-serif, body font, as the lexical editor parent uses a serif font. &__row {
.collapsible__toggle-wrap {
padding-inline-start: base(0.4);
}
}
margin: 0 0 1.5em; margin: 0 0 1.5em;

View File

@@ -2,7 +2,7 @@
html[data-theme='light'] { html[data-theme='light'] {
.slash-menu-popup { .slash-menu-popup {
@include shadow-m; @include shadow-lg;
} }
} }

View File

@@ -38,19 +38,19 @@
--gutter-h: #{base(3)}; --gutter-h: #{base(3)};
--spacing-view-bottom: var(--gutter-h); --spacing-view-bottom: var(--gutter-h);
--app-header-height: calc(var(--base) * 3); --doc-controls-height: calc(var(--base) * 2.8);
--doc-controls-height: calc(var(--base) * 3); --app-header-height: calc(var(--base) * 2.8);
--nav-width: 275px; --nav-width: 275px;
--nav-trans-time: 150ms; --nav-trans-time: 150ms;
@include mid-break { @include mid-break {
--gutter-h: #{base(2)}; --gutter-h: #{base(2)};
--app-header-height: calc(var(--base) * 2); --app-header-height: calc(var(--base) * 2.4);
--doc-controls-height: calc(var(--base) * 2.5); --doc-controls-height: calc(var(--base) * 2.4);
} }
@include small-break { @include small-break {
--gutter-h: #{base(0.5)}; --gutter-h: #{base(0.8)};
--spacing-view-bottom: calc(var(--base) * 2); --spacing-view-bottom: calc(var(--base) * 2);
--nav-width: 100vw; --nav-width: 100vw;
} }

View File

@@ -96,6 +96,7 @@
font-size: $baseline-body-size; font-size: $baseline-body-size;
line-height: $baseline-px; line-height: $baseline-px;
font-weight: normal; font-weight: normal;
font-family: var(--font-body);
} }
%code { %code {

View File

@@ -35,11 +35,11 @@
height: base(1); height: base(1);
svg { svg {
width: base(2.75); width: base(2);
height: base(2.75); height: base(2);
position: relative; position: relative;
left: base(-0.825); inset-inline-start: base(-0.5);
top: base(-0.825); top: base(-0.5);
.stroke { .stroke {
stroke-width: 2px; stroke-width: 2px;

View File

@@ -38,19 +38,19 @@
--gutter-h: #{base(3)}; --gutter-h: #{base(3)};
--spacing-view-bottom: var(--gutter-h); --spacing-view-bottom: var(--gutter-h);
--app-header-height: calc(var(--base) * 3); --doc-controls-height: calc(var(--base) * 2.8);
--doc-controls-height: calc(var(--base) * 3); --app-header-height: calc(var(--base) * 2.8);
--nav-width: 275px; --nav-width: 275px;
--nav-trans-time: 150ms; --nav-trans-time: 150ms;
@include mid-break { @include mid-break {
--gutter-h: #{base(2)}; --gutter-h: #{base(2)};
--app-header-height: calc(var(--base) * 2); --app-header-height: calc(var(--base) * 2.4);
--doc-controls-height: calc(var(--base) * 2.5); --doc-controls-height: calc(var(--base) * 2.4);
} }
@include small-break { @include small-break {
--gutter-h: #{base(0.5)}; --gutter-h: #{base(0.8)};
--spacing-view-bottom: calc(var(--base) * 2); --spacing-view-bottom: calc(var(--base) * 2);
--nav-width: 100vw; --nav-width: 100vw;
} }

View File

@@ -96,6 +96,7 @@
font-size: $baseline-body-size; font-size: $baseline-body-size;
line-height: $baseline-px; line-height: $baseline-px;
font-weight: normal; font-weight: normal;
font-family: var(--font-body);
} }
%code { %code {

View File

@@ -57,7 +57,7 @@
height: 100%; height: 100%;
flex-grow: 1; flex-grow: 1;
justify-content: space-between; justify-content: space-between;
overflow: hidden; width: 100%;
} }
&__account { &__account {
@@ -90,12 +90,14 @@
align-items: center; align-items: center;
flex-grow: 1; flex-grow: 1;
overflow: hidden; overflow: hidden;
width: 100%;
} }
&__step-nav-wrapper { &__step-nav-wrapper {
flex: 1; flex-grow: 0;
overflow: auto; overflow: auto;
display: flex; display: flex;
width: 100%;
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;
@@ -156,7 +158,7 @@
} }
@include small-break { @include small-break {
&__localizer { &__localizer.localizer {
right: base(2); right: base(2);
} }

View File

@@ -17,12 +17,12 @@
gap: base(0.8); gap: base(0.8);
&__title { &__title {
@extend %h4; @extend %h5;
letter-spacing: 0; letter-spacing: 0;
font-weight: 600; font-weight: 600;
line-height: base(1.2); line-height: base(0.8);
width: 100%; width: 100%;
margin: 0; margin: base(0.1) 0;
} }
&__actions { &__actions {

View File

@@ -17,9 +17,10 @@
gap: base(0.2); gap: base(0.2);
border-top-right-radius: $style-radius-m; border-top-right-radius: $style-radius-m;
border-top-left-radius: $style-radius-m; border-top-left-radius: $style-radius-m;
width: 100%;
& > * { & > * {
z-index: 2; z-index: 1;
} }
&:has(.collapsible__drag) { &:has(.collapsible__drag) {
@@ -87,6 +88,8 @@
left: 0; left: 0;
pointer-events: none; pointer-events: none;
width: 100%; width: 100%;
overflow: hidden;
max-width: 100%;
} }
&__header-wrap--has-drag-handle { &__header-wrap--has-drag-handle {

View File

@@ -6,6 +6,7 @@
align-items: center; align-items: center;
height: 100%; height: 100%;
justify-content: center; justify-content: center;
padding: base(2);
&__template { &__template {
z-index: 1; z-index: 1;

View File

@@ -6,6 +6,7 @@
align-items: center; align-items: center;
height: 100%; height: 100%;
justify-content: center; justify-content: center;
padding: base(2);
&__template { &__template {
z-index: 1; z-index: 1;

View File

@@ -24,7 +24,7 @@
position: relative; position: relative;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: space-between;
gap: var(--base); gap: var(--base);
padding-bottom: 1px; padding-bottom: 1px;
z-index: 4; z-index: 4;
@@ -36,6 +36,7 @@
align-items: center; align-items: center;
flex-grow: 1; flex-grow: 1;
overflow: hidden; overflow: hidden;
padding: base(0.8) 0;
} }
&__meta { &__meta {
@@ -46,6 +47,10 @@
gap: var(--base); gap: var(--base);
margin: 0; margin: 0;
width: 100%; width: 100%;
& button {
margin: 0;
}
} }
&__list-item { &__list-item {
@@ -64,6 +69,7 @@
white-space: nowrap; white-space: nowrap;
margin: 0; margin: 0;
font-weight: 600; font-weight: 600;
line-height: base(1.2);
} }
&__label { &__label {
@@ -141,7 +147,7 @@
// The timestamps and meta can scroll past // The timestamps and meta can scroll past
// The same container needs to the sticky, though // The same container needs to the sticky, though
// So we use a static height with a negative top equal to the meta height plus top padding // So we use a static height with a negative top equal to the meta height plus top padding
top: calc(var(--base) * -2); top: base(-2.8);
padding-right: 0; padding-right: 0;
padding-left: 0; padding-left: 0;
@@ -154,8 +160,7 @@
&__content { &__content {
width: 100%; width: 100%;
overflow: auto; overflow: auto;
height: calc(var(--base) * 2); padding-inline: base(2);
// this container has a fixed height // this container has a fixed height
// this means the scrollbar (when present) overlaps the content // this means the scrollbar (when present) overlaps the content
&::-webkit-scrollbar { &::-webkit-scrollbar {
@@ -166,14 +171,13 @@
&__meta { &__meta {
width: auto; width: auto;
gap: calc(var(--base) / 2); gap: calc(var(--base) / 2);
margin-left: var(--gutter-h);
&::after { &::after {
content: ''; content: '';
display: block; display: block;
position: sticky; position: absolute;
right: 0; right: 0;
width: calc(var(--base) * 2); width: base(0.8);
height: var(--base); height: var(--base);
background: linear-gradient(to right, transparent, var(--theme-bg)); background: linear-gradient(to right, transparent, var(--theme-bg));
flex-shrink: 0; flex-shrink: 0;
@@ -183,6 +187,7 @@
} }
&__controls-wrapper { &__controls-wrapper {
background-color: var(--theme-bg);
width: 100%; width: 100%;
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);
padding-right: var(--gutter-h); padding-right: var(--gutter-h);
@@ -215,4 +220,10 @@
} }
} }
} }
@include small-break {
&__content {
padding-inline: base(0.8);
}
}
} }

View File

@@ -6,6 +6,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
padding: base(2);
.btn { .btn {
margin-right: $baseline; margin-right: $baseline;

View File

@@ -63,17 +63,11 @@
height: base(1); height: base(1);
svg { svg {
width: base(2.75); width: base(2);
height: base(2.75); height: base(2);
position: relative; position: relative;
[dir='ltr'] & { inset-inline-start: base(-0.5);
left: base(-0.825); top: base(-0.5);
}
[dir='rtl'] & {
right: base(-0.825);
}
top: base(-0.825);
.stroke { .stroke {
stroke-width: 2px; stroke-width: 2px;

View File

@@ -6,6 +6,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
padding: base(2);
&__template { &__template {
position: relative; position: relative;

View File

@@ -48,10 +48,22 @@
&__wrap { &__wrap {
flex-wrap: wrap; flex-wrap: wrap;
background-color: unset; background-color: unset;
padding: 0;
position: relative;
}
.icon--search {
position: absolute;
top: base(0.4);
inset-inline-start: base(0.4);
z-index: 1;
} }
.search-filter { .search-filter {
width: 100%; width: 100%;
input {
padding: base(0.4) base(2);
}
} }
&__buttons-wrap { &__buttons-wrap {
@@ -64,11 +76,8 @@
} }
.pill { .pill {
padding: base(0.5) base(1); padding: base(0.2) base(0.2) base(0.2) base(0.4);
justify-content: space-between;
svg {
margin-left: auto;
}
} }
} }

View File

@@ -65,11 +65,11 @@
height: base(1); height: base(1);
svg { svg {
width: base(2.75); width: base(2);
height: base(2.75); height: base(2);
position: relative; position: relative;
left: base(-0.825); inset-inline-start: base(-0.5);
top: base(-0.825); top: base(-0.5);
.stroke { .stroke {
stroke-width: 2px; stroke-width: 2px;

View File

@@ -5,12 +5,18 @@
align-items: center; align-items: center;
white-space: nowrap; white-space: nowrap;
display: flex; display: flex;
padding-inline-start: base(0.4);
padding-inline-end: base(0.1);
gap: 0;
background-color: var(--theme-elevation-100);
border-radius: var(--style-radius-s);
&__label { &__label {
color: var(--theme-elevation-500); color: var(--theme-elevation-500);
} }
&__chevron { &__chevron {
padding: base(0.1);
.stroke { .stroke {
stroke: currentColor; stroke: currentColor;
} }

View File

@@ -22,12 +22,10 @@ export const LocalizerLabel: React.FC<{
aria-label={ariaLabel || t('general:locale')} aria-label={ariaLabel || t('general:locale')}
className={[baseClass, className].filter(Boolean).join(' ')} className={[baseClass, className].filter(Boolean).join(' ')}
> >
<div className={`${baseClass}__label`}>{`${t('general:locale')}:`}</div> <div className={`${baseClass}__label`}>{`${t('general:locale')}:`}&nbsp;</div>
&nbsp;&nbsp;
<span className={`${baseClass}__current-label`}> <span className={`${baseClass}__current-label`}>
{`${getTranslation(locale.label, i18n)}`} {`${getTranslation(locale.label, i18n)}`}
</span> </span>
&nbsp;
<ChevronIcon className={`${baseClass}__chevron`} /> <ChevronIcon className={`${baseClass}__chevron`} />
</div> </div>
) )

View File

@@ -5,6 +5,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
padding: base(2);
&__template { &__template {
z-index: 1; z-index: 1;

View File

@@ -23,6 +23,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%; height: 100%;
padding: base(2);
&__toggle { &__toggle {
@extend %btn-reset; @extend %btn-reset;

View File

@@ -13,6 +13,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--base); gap: var(--base);
padding: base(2);
} }
&__content { &__content {

View File

@@ -75,6 +75,6 @@
} }
@include small-break { @include small-break {
gap: calc(var(--base) / 4); gap: base(0.4);
} }
} }

View File

@@ -5,6 +5,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
padding: base(2);
&__template { &__template {
z-index: 1; z-index: 1;

View File

@@ -2,15 +2,20 @@
.section-title { .section-title {
position: relative; position: relative;
min-width: 0; width: 100%;
max-width: 100%;
pointer-events: all; pointer-events: all;
display: flex;
overflow: hidden;
&:after { &:after {
display: block; display: block;
content: attr(data-value) ' '; content: attr(data-value) ' ';
visibility: hidden; visibility: hidden;
white-space: nowrap; white-space: nowrap;
min-width: base(2.5); overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
} }
&:after, &:after,
@@ -19,13 +24,18 @@
font-weight: 600; font-weight: 600;
font-size: base(0.625); font-size: base(0.625);
padding: 0; padding: 0;
width: 100%;
} }
&__input { &__input {
color: var(--theme-elevation-800); color: var(--theme-elevation-800);
background-color: transparent; background-color: transparent;
border: none; border: none;
min-width: min-content;
width: 100%; width: 100%;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
resize: none; resize: none;
appearance: none; appearance: none;

View File

@@ -61,6 +61,7 @@
&__block-header { &__block-header {
display: inline-flex; display: inline-flex;
max-width: 100%; max-width: 100%;
width: 100%;
overflow: hidden; overflow: hidden;
gap: base(0.375); gap: base(0.375);
} }

View File

@@ -38,19 +38,19 @@
--gutter-h: #{base(3)}; --gutter-h: #{base(3)};
--spacing-view-bottom: var(--gutter-h); --spacing-view-bottom: var(--gutter-h);
--app-header-height: calc(var(--base) * 3); --doc-controls-height: calc(var(--base) * 2.8);
--doc-controls-height: calc(var(--base) * 3); --app-header-height: calc(var(--base) * 2.8);
--nav-width: 275px; --nav-width: 275px;
--nav-trans-time: 150ms; --nav-trans-time: 150ms;
@include mid-break { @include mid-break {
--gutter-h: #{base(2)}; --gutter-h: #{base(2)};
--app-header-height: calc(var(--base) * 2); --app-header-height: calc(var(--base) * 2.8);
--doc-controls-height: calc(var(--base) * 2.5); --doc-controls-height: calc(var(--base) * 2.5);
} }
@include small-break { @include small-break {
--gutter-h: #{base(0.5)}; --gutter-h: #{base(0.8)};
--spacing-view-bottom: calc(var(--base) * 2); --spacing-view-bottom: calc(var(--base) * 2);
--nav-width: 100vw; --nav-width: 100vw;
} }

View File

@@ -96,6 +96,7 @@
font-size: $baseline-body-size; font-size: $baseline-body-size;
line-height: $baseline-px; line-height: $baseline-px;
font-weight: normal; font-weight: normal;
font-family: var(--font-body);
} }
%code { %code {

View File

@@ -18,7 +18,7 @@ $baseline-body-size: 13px !default;
$baseline: math.div($baseline-px, $baseline-body-size) + rem; $baseline: math.div($baseline-px, $baseline-body-size) + rem;
@function base($multiplier) { @function base($multiplier) {
@return (math.div($baseline-px, $baseline-body-size) * $multiplier) + rem; @return ($baseline-px * $multiplier);
} }
////////////////////////////// //////////////////////////////