diff --git a/.storybook/components/icons/MuseumIcon.jsx b/.storybook/components/icons/MuseumIcon.jsx new file mode 100644 index 0000000000..0f667a1e5e --- /dev/null +++ b/.storybook/components/icons/MuseumIcon.jsx @@ -0,0 +1,18 @@ +import React from 'react'; + +export const MuseumIcon = () => ( + + + +); diff --git a/.storybook/pages/museum/index.module.css b/.storybook/pages/museum/index.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.storybook/pages/museum/index.tsx b/.storybook/pages/museum/index.tsx new file mode 100644 index 0000000000..47c1af5bf8 --- /dev/null +++ b/.storybook/pages/museum/index.tsx @@ -0,0 +1,81 @@ +import React, { useState, useEffect } from 'react'; +import { Typography } from '@alfalab/core-components-typography'; +import { useMatchMedia } from '@alfalab/core-components-mq'; +import { Gap } from '@alfalab/core-components-gap'; +import { Link } from '@alfalab/core-components-link'; +import { Divider } from '@alfalab/core-components-divider'; + +export const Museum = () => { + const [versions, setVersions] = useState([]); + const [isMobile] = useMatchMedia('--mobile'); + + useEffect(() => { + const ac = new AbortController(); + const { signal } = ac; + + fetch('https://core-ds.github.io/core-components/master/archive-versions.json', { signal }) + .then((res) => res.json()) + .then((res: string[]) => setVersions(res.sort((a, b) => b.localeCompare(a)))) + .catch((e) => { + if (!signal?.aborted) { + console.error(e); + } + }); + + return () => ac.abort('unmount'); + }, []); + + const Title = isMobile ? Typography.TitleMobile : Typography.Title; + + const renderItem = (version: string, index: number, showSkeleton: boolean) => ( +
+ + + {version.slice(1)} + + + + + Последняя версия + +  перед обновлением до версии  + {version + .slice(1) + .split('.') + .map((part, idx) => (idx === 0 ? Number(part) + 1 : 0)) + .join('.')} + + {versions.length - 1 !== index ? ( + <> + + + + ) : null} +
+ ); + + return ( +
+ + Музей демок + + + + + + Перед каждой мажоркой мы создаём музейную демку для того, чтобы у вас была + возможность посмотреть как работал компонент в прошлых версиях core и почитать его + описание. Возможно, ваша версия Core уже в музее, тогда такая демка это единственный + способ посмотреть актуальную документацию к компоненту. + + + {versions.length + ? versions.map((v, i) => renderItem(v, i, false)) + : [...Array(10)].map((_, i) => renderItem(`v${i}.0.0`, i, true))} +
+ ); +}; diff --git a/.storybook/preview.js b/.storybook/preview.js index c8be3d38a9..9b91ead885 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -105,6 +105,7 @@ export const parameters = { 'Components overview', 'Icons overview', 'Changelog', + 'Museum', 'Sandbox', 'Components', 'Deprecated components', diff --git a/.storybook/render-label.js b/.storybook/render-label.js index 044cd1e5b5..812bdf0f52 100644 --- a/.storybook/render-label.js +++ b/.storybook/render-label.js @@ -8,6 +8,7 @@ import { SandboxIcon } from './components/icons/SandboxIcon.jsx'; import { OverviewIcon } from './components/icons/OverviewIcon.jsx'; import { ComponentsOverviewIcon } from './components/icons/ComponentsOverviewIcon.jsx'; import { DiamondsBlankIcon } from './components/icons/DiamondsBlankIcon.jsx'; +import { MuseumIcon } from './components/icons/MuseumIcon.jsx'; const renderIcon = (item) => { const { type, name, parent, depth } = item; @@ -26,6 +27,9 @@ const renderIcon = (item) => { if (name === 'Components overview') { return ; } + if (name === 'Museum') { + return ; + } return ( <> diff --git a/docs/9.0.accessibility.stories.mdx b/docs/accessibility.stories.mdx similarity index 100% rename from docs/9.0.accessibility.stories.mdx rename to docs/accessibility.stories.mdx diff --git a/docs/10.breakpoints.stories.mdx b/docs/breakpoints.stories.mdx similarity index 100% rename from docs/10.breakpoints.stories.mdx rename to docs/breakpoints.stories.mdx diff --git a/docs/13.changelog.stories.mdx b/docs/changelog.stories.mdx similarity index 100% rename from docs/13.changelog.stories.mdx rename to docs/changelog.stories.mdx diff --git a/docs/15.code-review.stories.mdx b/docs/code-review.stories.mdx similarity index 100% rename from docs/15.code-review.stories.mdx rename to docs/code-review.stories.mdx diff --git a/docs/5.colors.stories.mdx b/docs/colors.stories.mdx similarity index 100% rename from docs/5.colors.stories.mdx rename to docs/colors.stories.mdx diff --git a/docs/18.components.overview.stories.mdx b/docs/components.overview.stories.mdx similarity index 100% rename from docs/18.components.overview.stories.mdx rename to docs/components.overview.stories.mdx diff --git a/docs/16.confirmation-update.stories.mdx b/docs/confirmation-update.stories.mdx similarity index 100% rename from docs/16.confirmation-update.stories.mdx rename to docs/confirmation-update.stories.mdx diff --git a/docs/22.contributing.stories.mdx b/docs/contributing.stories.mdx similarity index 100% rename from docs/22.contributing.stories.mdx rename to docs/contributing.stories.mdx diff --git a/docs/3.development-faq.stories.mdx b/docs/development-faq.stories.mdx similarity index 100% rename from docs/3.development-faq.stories.mdx rename to docs/development-faq.stories.mdx diff --git a/docs/9.3.forms.stories.mdx b/docs/forms.stories.mdx similarity index 100% rename from docs/9.3.forms.stories.mdx rename to docs/forms.stories.mdx diff --git a/docs/7.gaps.stories.mdx b/docs/gaps.stories.mdx similarity index 100% rename from docs/7.gaps.stories.mdx rename to docs/gaps.stories.mdx diff --git a/docs/1.getting-started.stories.mdx b/docs/getting-started.stories.mdx similarity index 100% rename from docs/1.getting-started.stories.mdx rename to docs/getting-started.stories.mdx diff --git a/docs/19.icons.overview.stories.mdx b/docs/icons.overview.stories.mdx similarity index 100% rename from docs/19.icons.overview.stories.mdx rename to docs/icons.overview.stories.mdx diff --git a/docs/8.icons.stories.mdx b/docs/icons.stories.mdx similarity index 100% rename from docs/8.icons.stories.mdx rename to docs/icons.stories.mdx diff --git a/docs/9.1.images.stories.mdx b/docs/images.stories.mdx similarity index 100% rename from docs/9.1.images.stories.mdx rename to docs/images.stories.mdx diff --git a/docs/21.installation.stories.mdx b/docs/installation.stories.mdx similarity index 100% rename from docs/21.installation.stories.mdx rename to docs/installation.stories.mdx diff --git a/docs/9.6.keyboard.stories.mdx b/docs/keyboard.stories.mdx similarity index 100% rename from docs/9.6.keyboard.stories.mdx rename to docs/keyboard.stories.mdx diff --git a/docs/9.5.menu.stories.mdx b/docs/menu.stories.mdx similarity index 100% rename from docs/9.5.menu.stories.mdx rename to docs/menu.stories.mdx diff --git a/docs/12.migrations.stories.mdx b/docs/migrations.stories.mdx similarity index 100% rename from docs/12.migrations.stories.mdx rename to docs/migrations.stories.mdx diff --git a/docs/museum.stories.mdx b/docs/museum.stories.mdx new file mode 100644 index 0000000000..65963f3bac --- /dev/null +++ b/docs/museum.stories.mdx @@ -0,0 +1,6 @@ +import { Meta } from '@storybook/addon-docs'; +import { Museum } from 'storybook/pages/museum'; + + + + diff --git a/docs/14.other-libs.stories.mdx b/docs/other-libs.stories.mdx similarity index 100% rename from docs/14.other-libs.stories.mdx rename to docs/other-libs.stories.mdx diff --git a/docs/11.screenshots.stories.mdx b/docs/screenshots.stories.mdx similarity index 100% rename from docs/11.screenshots.stories.mdx rename to docs/screenshots.stories.mdx diff --git a/docs/20.supported.browsers.stories.mdx b/docs/supported.browsers.stories.mdx similarity index 100% rename from docs/20.supported.browsers.stories.mdx rename to docs/supported.browsers.stories.mdx diff --git a/docs/9.4.tables.stories.mdx b/docs/tables.stories.mdx similarity index 100% rename from docs/9.4.tables.stories.mdx rename to docs/tables.stories.mdx diff --git a/docs/9.7.testing.stories.mdx b/docs/testing.stories.mdx similarity index 100% rename from docs/9.7.testing.stories.mdx rename to docs/testing.stories.mdx diff --git a/docs/2.theming.stories.mdx b/docs/theming.stories.mdx similarity index 100% rename from docs/2.theming.stories.mdx rename to docs/theming.stories.mdx diff --git a/docs/6.typography.stories.mdx b/docs/typography.stories.mdx similarity index 100% rename from docs/6.typography.stories.mdx rename to docs/typography.stories.mdx diff --git a/docs/23.users-faq.stories.mdx b/docs/users-faq.stories.mdx similarity index 100% rename from docs/23.users-faq.stories.mdx rename to docs/users-faq.stories.mdx diff --git a/docs/17.validation.stories.mdx b/docs/validation.stories.mdx similarity index 100% rename from docs/17.validation.stories.mdx rename to docs/validation.stories.mdx diff --git a/docs/9.2.video-audio.stories.mdx b/docs/video-audio.stories.mdx similarity index 100% rename from docs/9.2.video-audio.stories.mdx rename to docs/video-audio.stories.mdx