Skip to content

Commit

Permalink
add storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey committed Mar 21, 2024
1 parent 0819026 commit 0d800a4
Show file tree
Hide file tree
Showing 3 changed files with 1,941 additions and 0 deletions.
70 changes: 70 additions & 0 deletions demo/src/Components/ConstructorPage/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.g-root {
--dc-header-height: 0px;
--pc-first-block-indent: 0px;
--pc-first-block-mobile-indent: 0px;

.dc-root_full-header & {
--dc-header-height: 64px;
}
}

@media only screen and (max-width: 577px) {
.pc-block-base.pc-block-base.pc-block-base:first-child {
margin-top: var(--pc-first-block-mobile-indent, 64px);
}
}

.pc-block-base.pc-block-base.pc-block-base:first-child {
margin-top: var(--pc-first-block-indent, 96px);
}

.pc-Grid .pc-Grid {
.container-fluid .pc-header-block__container-fluid {
padding-right: 40px;
padding-left: 40px;
}
}

.pc-block-base {
padding: 0 !important;
}

.pc-navigation {
z-index: 101;

.desktop .dc-root_wide-format & .container-fluid {
padding: 0;

& .col {
padding: 0;
}
}

.mobile .dc-root_wide-format & .container-fluid {
padding: 12px;

& .col {
padding: 0;
}
}
}

.pc-navigation-popup {
background: var(--g-color-base-background);
}

.pc-desktop-navigation {
&__right {
flex: 0 1 auto;
}

&__buttons {
flex-basis: 100%;
justify-content: end;
}

&__item {
width: 100%;
transition: width 0.3s;
}
}
75 changes: 75 additions & 0 deletions demo/src/Components/ConstructorPage/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React, {useEffect} from 'react';

import {
ConstructorPage as ConstructorPageComponent,
ConstructorPageData,
DocumentType,
} from '@diplodoc/components';
import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor';
import {ThemeProvider} from '@gravity-ui/uikit';
import cn from 'bem-cn-lite';

import {updateBodyClassName} from '../utils';

import pageContent from './page.json';

import './index.scss';

const layoutBlock = cn('Layout');

const ConstructorPageDemo = (args) => {
const isMobile = args['Mobile'];
const theme = args['Theme'];
const router = {pathname: '/docs/compute'};

useEffect(() => {
updateBodyClassName(theme);
}, [theme]);

const Page = () => {
return (
<div className={isMobile === 'true' ? 'mobile' : 'desktop'}>
<div className={layoutBlock('content')}>
<ConstructorPageComponent
{...(pageContent as ConstructorPageData)}
wideFormat={true}
router={router}
type={DocumentType.ConstructorPage}
/>
</div>
</div>
);
};

return (
<div className="App">
<ThemeProvider theme={theme}>
<PageConstructorProvider theme={theme}>
<PageConstructor
custom={{
blocks: {
page: () => <Page />,
},
}}
content={{
blocks: [
{
type: 'page',
},
],
}}
/>
</PageConstructorProvider>
</ThemeProvider>
</div>
);
};

export default {
title: 'Pages/Constructor',
component: ConstructorPageDemo,
};

export const Constructor = {
args: {},
};
Loading

0 comments on commit 0d800a4

Please sign in to comment.