-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from KasperskyLab/feature/add-datepicker-l18n
feat: add datepicker l18n
- Loading branch information
Showing
26 changed files
with
1,154 additions
and
233 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
packages/kaspersky-components/.storybook/components/Meta/MetaDod.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { FC, useMemo } from 'react' | ||
import styled from 'styled-components' | ||
import { Tag } from '@src/tag' | ||
import { metaDod, MetaDodProps } from './types' | ||
|
||
const StyledTableContainer = styled.div` | ||
&&&&& { | ||
width: 300px; | ||
td, th, tr { | ||
background: transparent; | ||
border: none; | ||
} | ||
} | ||
` | ||
|
||
type MetaDodKeys = keyof MetaDodProps['list'] | ||
|
||
export const MetaDod: FC<MetaDodProps> = ({ list }: MetaDodProps) => { | ||
const metaDodKeys = useMemo(() => Object.keys(metaDod) as MetaDodKeys[], []) | ||
|
||
return ( | ||
<StyledTableContainer> | ||
<table> | ||
<thead> | ||
<tr> | ||
{ | ||
metaDodKeys.map(key => ( | ||
<td>{metaDod[key]}</td> | ||
)) | ||
} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
{ | ||
metaDodKeys.map(key => ( | ||
<td> | ||
<Tag mode={list[key] ? 'grass' : 'red'}> | ||
{list[key] ? 'ready' : 'need'} | ||
</Tag> | ||
</td> | ||
)) | ||
} | ||
</tr> | ||
</tbody> | ||
</table> | ||
</StyledTableContainer> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
packages/kaspersky-components/.storybook/components/Meta/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { withMeta } from './withMeta' |
23 changes: 23 additions & 0 deletions
23
packages/kaspersky-components/.storybook/components/Meta/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export type MetaList = { | ||
dod?: MetaDodProps['list'], | ||
component?: string, | ||
description?: string, | ||
usage?: string, | ||
designLink?: string, | ||
figmaView?: string | ||
} | ||
|
||
export const metaDod = { | ||
designTokens: 'Design tokens', | ||
useThemedHook: 'Theme hook', | ||
unitTests: 'Unit tests', | ||
screenshotTests: 'Screenshot tests', | ||
migration: 'Migration', | ||
apiTable: 'Api', | ||
storybook: 'Storybook', | ||
figmaView: 'Figma' | ||
} | ||
|
||
export type MetaDodProps = { | ||
list: Partial<Record<keyof typeof metaDod, boolean>> | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/kaspersky-components/.storybook/components/Meta/withMeta.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
Title, | ||
Subtitle, | ||
Markdown, | ||
Primary, | ||
ArgTypes, | ||
Stories, | ||
PRIMARY_STORY | ||
} from '@storybook/blocks' | ||
import React from 'react' | ||
|
||
import { MetaDod } from './MetaDod' | ||
import { MetaList } from './types' | ||
|
||
export function withMeta ( | ||
list: MetaList, | ||
Component?: React.FC | ||
): React.FC { | ||
const setMeta = (props: any) => { | ||
return ( | ||
<> | ||
<Title>{list.component}</Title> | ||
{list.dod && <MetaDod list={list.dod} />} | ||
<Subtitle>Описание</Subtitle> | ||
{list.description ? <Markdown>{list.description}</Markdown> : '-'} | ||
<Subtitle>Использование</Subtitle> | ||
{list.usage ? <Markdown>{list.usage}</Markdown>: '-'} | ||
{list.designLink && <Markdown>{`[Дизайн](${list.designLink})`}</Markdown>} | ||
{Component && <Component {...props} />} | ||
<Primary /> | ||
<ArgTypes of={PRIMARY_STORY} /> | ||
<Stories title={'Variants of View'} /> | ||
</> | ||
) | ||
} | ||
return setMeta | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Addon_ArgType } from '@storybook/types' | ||
|
||
export const sbSetDefaultValue = (text: string) => ({ | ||
table: { defaultValue: { summary: text } } | ||
}) | ||
|
||
export const sbHideControl = { control: false } as SBArgType | ||
|
||
export const sbHideControls = (controls: string[]) => ( | ||
controls.reduce((acc, control) => { | ||
acc[control] = { control: false } | ||
return acc | ||
}, {} as SBArgTypes) | ||
) | ||
|
||
export type SBArgType = Addon_ArgType | ||
export type SBArgTypes = { [key in string]: SBArgType } | ||
export type SBArgTypeControl = SBArgType['control'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 24 additions & 24 deletions
48
packages/kaspersky-components/design-system/theme/themes/light/picker.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.