diff --git a/packages/pl-fe/src/components/ui/card.tsx b/packages/pl-fe/src/components/ui/card.tsx index 977901635..fc1c179d7 100644 --- a/packages/pl-fe/src/components/ui/card.tsx +++ b/packages/pl-fe/src/components/ui/card.tsx @@ -5,9 +5,6 @@ import { Link } from 'react-router-dom'; import SvgIcon from 'pl-fe/components/ui/svg-icon'; -import HStack from './hstack'; -import Text from './text'; - const sizes = { md: 'p-4 sm:rounded-xl', lg: 'p-4 sm:p-6 sm:rounded-xl', @@ -71,19 +68,19 @@ const CardHeader: React.FC = ({ className, children, backHref, onBa const backAttributes = backHref ? { to: backHref } : { onClick: onBackClick }; return ( - - - {intl.formatMessage(messages.back)} + + + {intl.formatMessage(messages.back)} ); }; return ( - +
{renderBackButton()} {children} - +
); }; @@ -94,7 +91,7 @@ interface ICardTitle { /** A card's title. */ const CardTitle: React.FC = ({ title, truncate = true }): JSX.Element => ( - {title} +

{title}

); interface ICardBody { diff --git a/packages/pl-fe/src/styles/new/components.scss b/packages/pl-fe/src/styles/new/components.scss index 9e481e7e2..18059eeba 100644 --- a/packages/pl-fe/src/styles/new/components.scss +++ b/packages/pl-fe/src/styles/new/components.scss @@ -141,3 +141,23 @@ a.⁂-list-item, .⁂-select { @apply truncate rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-primary-500 focus:outline-none focus:ring-primary-500 disabled:opacity-50 black:bg-black dark:border-gray-800 dark:bg-gray-900 dark:text-gray-100 dark:ring-1 dark:ring-gray-800 dark:focus:border-primary-500 dark:focus:ring-primary-500 sm:text-sm; } + +.⁂-card-header { + @apply flex items-center gap-2; + + &__button { + @apply rounded-full text-gray-900 focus:ring-2 focus:ring-primary-500 dark:text-gray-100; + + >.⁂-icon { + size: 1.5rem; + @apply rtl:rotate-180; + } + &__label { + @apply sr-only; + } + } +} + +.⁂-card-title { + @include mixins.text($size: xl, $weight: bold, $truncate: truncate); +} diff --git a/packages/pl-fe/src/styles/new/mixins.scss b/packages/pl-fe/src/styles/new/mixins.scss index 02dce4406..b67af254d 100644 --- a/packages/pl-fe/src/styles/new/mixins.scss +++ b/packages/pl-fe/src/styles/new/mixins.scss @@ -2,23 +2,29 @@ @if $family == sans { @apply font-sans; } @else if $family == mono { - @apply font-mono; + font-family: Roboto Mono, ui-monospace, monospace; } @else { @warn "Unknown font family `#{$family}`."; } @if $size == sm { - @apply text-sm; + font-size: 0.875rem; + line-height: 1.25rem; } @else if $size == md { - @apply text-base leading-5; + font-size: 0.9375rem; + line-height: 1.25rem; } @else if $size == lg { - @apply text-lg; + font-size: 1.125rem; + line-height: 1.75rem; } @else if $size == xl { - @apply text-xl; + font-size: 1.25rem; + line-height: 1.75rem; } @else if $size == 2xl { - @apply text-2xl; + font-size: 1.5rem; + line-height: 2rem; } @else if $size == 3xl { - @apply text-3xl; + font-size: 1.875rem; + line-height: 2.25rem; } @else { @warn "Unknown font size `#{$size}`."; } @@ -36,42 +42,77 @@ } @else if $theme == success { @apply text-success-600; } @else if $theme == inherit { - @apply text-inherit; + color: inherit; } @else if $theme == white { - @apply text-white; + color: #fff; } @else { @warn "Unknown text theme `#{$theme}`."; } @if $tracking == normal { - @apply tracking-normal; + letter-spacing: 0em; } @else if $tracking == wide { - @apply tracking-wide; + letter-spacing: 0.025em; } @else { @warn "Unknown letter spacing `#{$tracking}`."; } @if $transform == normal { - @apply normal-case; + text-transform: none; } @else if $transform == uppercase { - @apply uppercase; + text-transform: uppercase; } @else { @warn "Unknown text transform `#{$transform}`."; } @if $truncate { - @apply truncate; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } @if $weight == normal { - @apply font-normal; + font-weight: 400; } @else if $weight == medium { - @apply font-medium; + font-weight: 500; } @else if $weight == semibold { - @apply font-semibold; + font-weight: 600; } @else if $weight == bold { - @apply font-bold; + font-weight: 700; } @else { @warn "Unknown font weight `#{$weight}`."; } +} + +@mixin card($variant: default, $size: md) { + @if $variant == rounded { + @apply bg-white dark:bg-primary-900 black:bg-black text-gray-900 dark:text-gray-100 shadow-lg dark:shadow-none; + + @if $size == md { + padding: 1rem; + @media (min-width: 581px) { + border-radius: 0.75rem; + } + } @else if $size == lg { + padding: 1rem; + @media (min-width: 581px) { + padding: 1.5rem; + border-radius: 0.75rem; + } + } @else if $size == xl { + padding: 1rem; + @media (min-width: 581px) { + padding: 2.5rem; + border-radius: 1.5rem; + } + } @else { + @warn "Unknown card size `#{$size}`."; + } + } @else if $variant == slim { + @apply py-4; + } + + @if $size != xl { + @apply .black:rounded-none; + } } \ No newline at end of file