Skip to content

Commit

Permalink
docs(ColorPage): shadow page
Browse files Browse the repository at this point in the history
  • Loading branch information
VadymBezpalko committed Jan 26, 2024
1 parent 7048772 commit 88dc067
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 257 deletions.
97 changes: 0 additions & 97 deletions packages/react-components/src/docs/components/Shadow/Shadow.tsx

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 7 additions & 0 deletions packages/react-components/src/docs/components/Table/Table.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ table tr:not(:last-of-type) td {
width: 32px;
height: 32px;
}

.shadow-example {
border-radius: var(--radius-4);
background: var(--surface-primary-default);
width: 48px;
height: 48px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ To use color tokens in your project, you need to import the `DesignToken` consta
import { DesignToken } from '@livechat/design-system-react-components';
```

<hr />
`DesignToken` contains all the color tokens available in the design system. You can use them in your project by using the `var()` function in CSS:

```css
.my-element {
background-color: var(DesignToken.SurfaceBasicSubtle);
}
```

## Content

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { Meta, Canvas } from '@storybook/addon-docs';
import { Shadow } from '../../components/Shadow/Shadow';
import { ShadowExamples } from '../../components/Shadow/ShadowExamples';
import { Meta } from '@storybook/addon-docs';
import { ShadowTable } from './ShadowTable';
import { ShadowTokens } from './constants';

<Meta title="Foundations/Shadow" />

# Shadow

Shadows tokens in a design system add depth for a polished look and establishing hierarchy and predictability in user interface.

<Canvas
style={{
color: 'var(--content-default)',
backgroundColor: 'var(--background)',
}}
>
<Shadow />
</Canvas>

## Examples

<Canvas
style={{
color: 'var(--content-default)',
backgroundColor: 'var(--background)',
}}
>
<ShadowExamples />
</Canvas>
## Usage

To use shadow tokens in your project, you need to import the `ShadowToken` constant from `@livechat/design-system-react-components`:

```jsx
import { ShadowToken } from '@livechat/design-system-react-components';
```

`ShadowToken` contains all the shadow tokens available in the design system. You can use them in your project by using the `var()` function in CSS:

```css
.my-element {
box-shadow: var(${ShadowToken.PopOver});
}
```

## Tokens

<ShadowTable data={ShadowTokens} />
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const ShadowTable: React.FC<IColorTableProps> = ({ data }) => {
<tr>
<td onClick={() => handleCopyText(shadow.enum)}>
<div
className="color-example"
style={{ backgroundColor: `var(${shadow.value})` }}
className="shadow-example"
style={{ boxShadow: `var(${shadow.value})` }}
/>
{shadow.enum}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ import { ShadowToken, ShadowTokenKey } from '../../../foundations/shadow-token';

import { ShadowShape } from './types';

export const ShadowTokens: ShadowShape[] = Object.entries(ShadowToken).map(
([key, value]) => ({
enum: key,
value,
desc: ShadowDescription[key as ShadowTokenKey],
})
);

const ShadowDescription: Record<ShadowTokenKey, string> = {
Float: 'Float sample description',
PopOver: 'PopOver sample description',
Expand All @@ -29,3 +21,11 @@ const ShadowDescription: Record<ShadowTokenKey, string> = {
DividerBottomRight: 'DividerBottomRight sample description',
MessageBox: 'MessageBox sample description',
};

export const ShadowTokens: ShadowShape[] = Object.entries(ShadowToken).map(
([key, value]) => ({
enum: key as ShadowTokenKey,
value,
desc: ShadowDescription[key as ShadowTokenKey],
})
);

0 comments on commit 88dc067

Please sign in to comment.