Skip to content

Commit

Permalink
feat: added elevation to redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuEScioN committed Oct 17, 2024
1 parent e5ad0bb commit 63bb978
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/stories/Elevation.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Box } from '@/ui/Box';
import { Flex } from '@/ui/Flex';
import { Text } from '@/ui/Text';
import { useColorMode } from '@/ui/hooks/useColorMode';

Check warning on line 4 in src/stories/Elevation.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/stories/Elevation.stories.tsx#L1-L4

Added lines #L1 - L4 were not covered by tests
import type { Meta, StoryObj } from '@storybook/react';

import { theme } from '../ui/theme/theme';

Check warning on line 7 in src/stories/Elevation.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/stories/Elevation.stories.tsx#L7

Added line #L7 was not covered by tests

const ElevationDemo = () => {
const { colorMode } = useColorMode();

Check warning on line 10 in src/stories/Elevation.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/stories/Elevation.stories.tsx#L9-L10

Added lines #L9 - L10 were not covered by tests

return (
<Flex direction="column" gap={8}>
<Text fontSize="2xl" fontWeight="bold">
Elevation Showcase
</Text>
{Object.entries(theme.semanticTokens.shadows).map(([elevationName, elevationValue]) => (
<Flex key={elevationName} align="center" gap={4}>

Check warning on line 18 in src/stories/Elevation.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/stories/Elevation.stories.tsx#L18

Added line #L18 was not covered by tests
<Box
width="200px"
height="100px"
bg={colorMode === 'light' ? 'white' : 'gray.800'}
boxShadow={(elevationValue as any)[colorMode === 'light' ? 'default' : '_dark']}
borderRadius="md"
display="flex"
alignItems="center"
justifyContent="center"
>
<Text>{elevationName}</Text>
</Box>
<Text>
{elevationName}: {(elevationValue as any)[colorMode === 'light' ? 'default' : '_dark']}
</Text>
</Flex>
))}
</Flex>
);
};

const meta = {

Check warning on line 40 in src/stories/Elevation.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/stories/Elevation.stories.tsx#L40

Added line #L40 was not covered by tests
title: 'Theme/Elevation',
component: ElevationDemo,
parameters: {
layout: 'padded',
},
tags: ['autodocs'],
} satisfies Meta<typeof ElevationDemo>;

export default meta;

Check warning on line 49 in src/stories/Elevation.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/stories/Elevation.stories.tsx#L49

Added line #L49 was not covered by tests
type Story = StoryObj<typeof meta>;

export const AllElevations: Story = {};

Check warning on line 52 in src/stories/Elevation.stories.tsx

View check run for this annotation

Codecov / codecov/patch

src/stories/Elevation.stories.tsx#L52

Added line #L52 was not covered by tests
14 changes: 14 additions & 0 deletions src/ui/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ export const theme = extendTheme({
_dark: 'white',
},
},
shadows: {
elevation1: {
default: '0 2px 6px rgba(183, 180, 176, 0.2)',
_dark: '0 2px 6px rgba(0, 0, 0, 0.2)',
},
elevation2: {
default: '0 8px 16px rgba(183, 180, 176, 0.2)',
_dark: '0 8px 16px rgba(0, 0, 0, 0.2)',
},
elevation3: {
default: '0 16px 32px rgba(183, 180, 176, 0.2)',
_dark: '0 16px 32px rgba(0, 0, 0, 0.2)',
},
},
},
styles: {
global: (props: StyleFunctionProps) => ({
Expand Down

0 comments on commit 63bb978

Please sign in to comment.