discourse/app/assets/stylesheets/common/components/theme-card.scss
Keegan George cb0ffb2978
UX: Improve theme picker modal and fix more card spacing (#40081)
**Previously**, the theme picker modal showed a non-clickable "Currently
selected" label on the default theme, the "Install more themes" card
lost its content/description spacing after the `ThemeCardPreview`
extraction, and the modal link text said "Browse all themes".

**In this update**, both theme cards show a "Use this theme" button
(allowing the current theme to be re-selected to complete onboarding),
the active card gets an "Enabled" badge in the top-right corner, the
install-more card spacing is restored, and the link text is renamed to
"Manage themes".

<img width="1057" height="748" alt="Screenshot 2026-05-15 at 10 53 42"
src="https://github.com/user-attachments/assets/a1ca56cf-59fe-4c53-9160-a79f2424e386"
/>
<img width="643" height="531" alt="Screenshot 2026-05-15 at 10 53 25"
src="https://github.com/user-attachments/assets/d124f1fc-9206-4e0f-aa71-47f9a202a5ba"
/>
2026-05-15 11:30:42 -07:00

261 lines
4.7 KiB
SCSS
Vendored

@mixin theme-card-border($color) {
border-color: var(--#{$color}-medium);
box-shadow: 0 0 0 3px var(--#{$color}-low);
}
.themes-cards-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 1em;
align-items: stretch;
margin-top: var(--space-4);
}
.theme-card {
display: flex;
flex-direction: column;
position: relative;
box-shadow: 0 0 0 3px transparent;
transition: box-shadow 0.3s ease-in-out;
height: 100%;
&.--updating {
animation:
updating 3s ease-in-out 1,
updatingInfinite 3s ease-in-out 3s infinite;
@keyframes updating {
0% {
box-shadow: 0 0 0 3px transparent;
border: 1px solid var(--success);
}
50% {
box-shadow: 0 0 0 6px var(--success-low);
border: 1px solid var(--success);
}
100% {
box-shadow: 0 0 0 3px var(--success-low);
border: 1px solid var(--success);
}
}
@keyframes updatingInfinite {
0% {
box-shadow: 0 0 0 3px var(--success-low);
border: 1px solid var(--success);
}
50% {
box-shadow: 0 0 0 6px var(--success-low);
border: 1px solid var(--success);
}
100% {
box-shadow: 0 0 0 3px var(--success-low);
border: 1px solid var(--success);
}
}
}
&.--updating .d-icon-arrows-rotate {
animation: rotate 3s linear infinite;
margin-right: 0.45em;
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
}
.admin-config-area-card__content {
display: flex;
flex-direction: column;
flex-grow: 1;
}
&.--default {
@include theme-card-border(tertiary);
}
&__icons {
display: flex;
}
.ember-checkbox {
margin: 0 5px 0 0;
}
&__checkbox-label {
margin: 0;
font-weight: 400;
}
&__title {
font-size: var(--font-up-0);
font-weight: 700;
display: flex;
gap: 0.5rem;
align-items: center;
overflow-wrap: anywhere;
color: var(--primary);
&:visited {
color: currentcolor;
}
&:hover,
&:focus {
color: var(--tertiary);
}
}
&__content {
padding-inline: 1rem;
padding-top: 1rem;
display: flex;
flex-direction: column;
flex-grow: 1;
}
&__description {
margin: 0 0 10px 0;
}
&__components {
display: -webkit-box;
font-size: var(--font-down-1);
color: var(--primary-high);
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 3;
}
&__install-button {
margin-top: auto;
}
&__install-more-icon {
height: 160px;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 1px solid var(--content-border-color);
background: var(--primary-very-low);
color: var(--primary-medium);
.d-icon {
width: 3rem;
height: 3rem;
}
}
&__button.--set-default {
position: absolute;
top: 4px;
right: 4px;
}
&__footer {
flex-direction: column;
padding-inline: 1rem;
padding-bottom: 1rem;
}
&__controls {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 0.5rem;
}
&__footer-actions {
margin-left: auto;
}
&__badges {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
align-items: flex-start;
min-height: 2rem;
}
&__badge {
font-size: var(--font-down-2);
padding: 0.15rem 0.3rem;
border-radius: 4px;
color: var(--primary-very-high);
background: var(--tertiary-low);
letter-spacing: 0.25px;
align-items: center;
display: inline-flex;
gap: 0.25rem;
svg {
height: 0.75em;
color: var(--primary-high);
}
}
.admin-config-area-card__header-action {
display: flex;
justify-content: center;
align-items: center;
background-color: var(--secondary);
right: 20px;
top: 22px;
}
}
.admin-config-area-card.theme-card
.admin-config-area-card__content
.external-resources {
display: flex;
justify-content: space-between;
flex-direction: column;
font-size: var(--font-down-1);
margin-bottom: 10px;
.external-link {
margin-bottom: 0.25em;
color: var(--primary);
text-decoration: underline;
}
}
.admin-config-area-card.theme-card {
padding: 0;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
.admin-config-area-card__content {
margin: 0;
padding-right: 0;
}
.admin-config-area-card__header-wrapper {
flex: none;
}
}
.admin-config-area-card.theme-card.--install-more {
border-style: dashed;
}
.admin-config-area-card.theme-install-card {
.theme-install-card__external-links {
svg {
font-size: var(--font-down-3);
margin-bottom: 0.1em;
}
}
}