Skip to content

Commit

Permalink
feat: add docs for Breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Feverqwe committed Sep 8, 2023
1 parent 527e1ad commit 57497e2
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 5 deletions.
36 changes: 36 additions & 0 deletions src/content/components/uikit/Breadcrumbs/BreadcrumbsWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {Breadcrumbs, BreadcrumbsProps} from '@gravity-ui/uikit';
import {FC} from 'react';

export const BreadcrumbsWrapper: FC<Omit<BreadcrumbsProps, 'items'>> = (props) => {
return (
<div style={{width: '220px'}}>
<Breadcrumbs
{...props}
items={[
{
text: 'Region',
action: () => {},
},
{
text: 'Country',
action: () => {},
},
{
text: 'City',
action: () => {},
},
{
text: 'District',
action: () => {},
},
{
text: 'Street',
action: () => {},
},
]}
firstDisplayedItemsCount={Number(props.firstDisplayedItemsCount)}
lastDisplayedItemsCount={Number(props.lastDisplayedItemsCount)}
/>
</div>
);
};
50 changes: 50 additions & 0 deletions src/content/components/uikit/Breadcrumbs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import dynamic from 'next/dynamic';

import {Repos} from '../../../../types/common';
import {getGithubUrl, getReadmeUrl} from '../../utils';

const getterOptions = {repoName: Repos.Uikit, componentName: 'Breadcrumbs'};

export const breadcrumbsConfig = {
id: 'breadcrumbs',
title: 'Breadcrumbs',
githubUrl: getGithubUrl(getterOptions),
content: {
readmeUrl: getReadmeUrl(getterOptions),
},
sandbox: {
component: dynamic(() =>
import('./BreadcrumbsWrapper').then((mod) => mod.BreadcrumbsWrapper),
),
props: {
firstDisplayedItemsCount: {
type: 'radioButton',
values: [
{
value: 0,
content: '0',
},
{
value: 1,
content: '1',
},
],
defaultValue: 0,
},
lastDisplayedItemsCount: {
type: 'radioButton',
values: [
{
value: 1,
content: '1',
},
{
value: 2,
content: '2',
},
],
defaultValue: 1,
},
},
},
};
7 changes: 2 additions & 5 deletions src/content/components/uikit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Component, Lib} from '../types';

import {alertConfig} from './Alert';
import {arrowToggleConfig} from './ArrowToggle';
import {breadcrumbsConfig} from './Breadcrumbs';
import {buttonConfig} from './Button';
import {cardConfig} from './Card';
import {checkboxConfig} from './Checkbox';
Expand Down Expand Up @@ -38,11 +39,7 @@ const {config} = getLibById('uikit');
const uikitComponents: Component[] = [
alertConfig,
arrowToggleConfig,
{
id: 'breadcrumbs',
title: 'Breadcrumbs',
isComingSoon: true,
},
breadcrumbsConfig,
buttonConfig,
cardConfig,
checkboxConfig,
Expand Down

0 comments on commit 57497e2

Please sign in to comment.