-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Валерия Чуричева
authored and
Валерия Чуричева
committed
Sep 6, 2023
1 parent
dccf90e
commit 5c909d5
Showing
38 changed files
with
376 additions
and
329 deletions.
There are no files selected for viewing
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,41 @@ | ||
import React, { FC, useState, ReactNode } from 'react'; | ||
import { Tabs, Tab, TabsProps } from '@alfalab/core-components-tabs'; | ||
import { ArgTypes } from '@storybook/addon-docs'; | ||
|
||
import styles from './index.module.css'; | ||
|
||
type Props = { | ||
components: Record<string, ReactNode>; | ||
}; | ||
|
||
export const ArgsTabs: FC<Props> = ({ components }) => { | ||
const [selected, setSelected] = useState(0); | ||
|
||
const handleChange: TabsProps['onChange'] = (_, { selectedId }) => { | ||
setSelected(selectedId as number); | ||
}; | ||
|
||
const keys = Object.keys(components); | ||
|
||
return ( | ||
<Tabs | ||
className='sb-unstyled' | ||
selectedId={selected} | ||
onChange={handleChange} | ||
containerClassName={styles.tabsTypes} | ||
view='secondary' | ||
size='xxs' | ||
scrollable={true} | ||
> | ||
{keys.map((key, index) => ( | ||
<Tab key={key} id={index} title={key}> | ||
{components[key] ? ( | ||
<ArgTypes of={components[key]} /> | ||
) : ( | ||
<div className={styles.error}>Что-то пошло не так </div> | ||
)} | ||
</Tab> | ||
))} | ||
</Tabs> | ||
); | ||
}; |
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,16 @@ | ||
@import '../../../packages/themes/src/default.css'; | ||
|
||
.tabsTypes { | ||
margin-top: var(--gap-xl); | ||
} | ||
|
||
.error { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 200px; | ||
border: 1px solid var(--color-light-border-secondary); | ||
border-radius: var(--border-radius-s); | ||
margin-top: var(--gap-xl); | ||
color: var(--color-light-text-secondary); | ||
} |
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 * from './component'; |
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
15 changes: 10 additions & 5 deletions
15
.storybook/blocks/component-header/ComponentHeader.module.css
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
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
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
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
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.