Skip to content

Commit

Permalink
feat(paper): move elevated Card to dedicated Paper component
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprevot committed Aug 22, 2023
1 parent 2f1f88f commit c20d2c9
Show file tree
Hide file tree
Showing 20 changed files with 328 additions and 844 deletions.
15 changes: 0 additions & 15 deletions packages/design-tokens/tokens/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ module.exports = {

value: '{color.feedback.warning.90.value}',
},
white: {
comment: 'Background color for white card.',

value: '{color.base.white.value}',
},
yellow: {
comment: 'Background color for yellow card.',

Expand Down Expand Up @@ -87,11 +82,6 @@ module.exports = {

value: '{color.feedback.warning.50.value}',
},
white: {
comment: 'Icon color for white card.',

value: '{color.text.dark.value}',
},
yellow: {
comment: 'Icon color for yellow card.',

Expand Down Expand Up @@ -144,11 +134,6 @@ module.exports = {

value: '{color.text.dark.value}',
},
white: {
comment: 'Text color for white card.',

value: '{color.text.dark.value}',
},
yellow: {
comment: 'Text color for yellow card.',

Expand Down
39 changes: 39 additions & 0 deletions packages/design-tokens/tokens/paper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
color: {
background: {
paper: {
comment: 'Background color for paper.',

value: '{color.base.white.value}',
},
},

text: {
paper: {
body: {
comment: 'Text color for the body of any paper.',

value: '{color.text.dark.value}',
},
},
},
},

size: {
paper: {
padding: {
horizontal: {
comment: 'Horizontal padding for any paper.',

value: '{size.spacing.2.value}',
},

vertical: {
comment: 'Vertical padding for any paper.',

value: '{size.spacing.2.value}',
},
},
},
},
}
5 changes: 5 additions & 0 deletions packages/fractal/fractal-panda.preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import * as InputRadioRecipes from '@/components/InputRadio/InputRadio.recipe'
import * as InputTextRecipes from '@/components/InputText/InputText.recipe'
import * as LoaderRecipes from '@/components/Loader/Loader.recipe'
import * as LogoRecipes from '@/components/Logo/Logo.recipe'
import * as PaperRecipes from '@/components/Paper/Paper.recipe'
import * as ProgressRecipes from '@/components/Progress/Progress.recipe'
import * as SelectRecipes from '@/components/Select/Select.recipe'
import * as StepperRecipes from '@/components/Stepper/Stepper.recipe'
Expand All @@ -47,6 +48,7 @@ const GROUPS = {
inputText: `${PREFIX}-${InputTextRecipes.GROUP_NAME}`,
loader: `${PREFIX}-${LoaderRecipes.GROUP_NAME}`,
logo: `${PREFIX}-${LogoRecipes.GROUP_NAME}`,
paper: `${PREFIX}-${PaperRecipes.GROUP_NAME}`,
progress: `${PREFIX}-${ProgressRecipes.GROUP_NAME}`,
select: `${PREFIX}-${SelectRecipes.GROUP_NAME}`,
selectTrigger: `${PREFIX}-${SelectRecipes.GROUP_NAME}-trigger`,
Expand Down Expand Up @@ -112,6 +114,9 @@ const fractalPreset = definePreset({
cardTitle: CardRecipes.cardTitle,
cardIcon: CardRecipes.cardIcon,

paper: PaperRecipes.paper,
paperContent: PaperRecipes.paperContent,

header: HeaderRecipes.header,
headerLeft: HeaderRecipes.headerLeft,
headerMiddle: HeaderRecipes.headerMiddle,
Expand Down
187 changes: 0 additions & 187 deletions packages/fractal/src/components/Card/BorderedCard.stories.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions packages/fractal/src/components/Card/Card.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ export enum Colors {
Purple = 'purple',
Success = 'success',
Warning = 'warning',
White = 'white',
Yellow = 'yellow',
}

export const DEFAULT_COLOR = Colors.Pink

export enum Elevations {
/* eslint-disable perfectionist/sort-enums */
Flat = '0',
Bordered = '1',
Low = '2',
High = '3',
/* eslint-enable perfectionist/sort-enums */
}

export const DEFAULT_ELEVATION = Elevations.Flat
32 changes: 1 addition & 31 deletions packages/fractal/src/components/Card/Card.recipe.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { defineRecipe } from '@pandacss/dev'
import type { SystemStyleObject } from '@snowball-tech/fractal-panda/types'

import {
Colors,
DEFAULT_COLOR,
DEFAULT_ELEVATION,
Elevations,
} from './Card.constants'
import { Colors, DEFAULT_COLOR } from './Card.constants'

export const GROUP_NAME = 'card'

Expand All @@ -29,7 +24,6 @@ export const card: ReturnType<typeof defineRecipe> = defineRecipe({

defaultVariants: {
color: DEFAULT_COLOR,
elevation: DEFAULT_ELEVATION,
},

variants: {
Expand All @@ -43,30 +37,6 @@ export const card: ReturnType<typeof defineRecipe> = defineRecipe({
}),
{} as Record<Colors, SystemStyleObject>,
),

elevation: {
[Elevations.Flat]: {
border: 'var(--border-none)',
boxShadow: 'var(--shadow-none)',
},
// eslint-disable-next-line sort-keys, sort-keys/sort-keys-fix, perfectionist/sort-objects
[Elevations.Bordered]: {
border: 'var(--border-1)',
borderRadius: 'var(--size-radius-s)',
boxShadow: 'var(--shadow-none)',
},
[Elevations.Low]: {
border: 'var(--border-1)',
borderRadius: 'var(--size-radius-s)',
boxShadow: 'var(--shadow-brutal-1)',
},
// eslint-disable-next-line sort-keys, sort-keys/sort-keys-fix, perfectionist/sort-objects
[Elevations.High]: {
border: 'var(--border-2)',
borderRadius: 'var(--size-radius-s)',
boxShadow: 'var(--shadow-brutal-2)',
},
},
},

// eslint-disable-next-line sort-keys, sort-keys/sort-keys-fix, perfectionist/sort-objects
Expand Down
Loading

0 comments on commit c20d2c9

Please sign in to comment.