Browse Source

Add more components to Storybook

Thibaud Colas 1 year ago
parent
commit
69eef34e56

+ 21 - 0
wagtail/admin/templates/wagtailadmin/home/whats_new_in_wagtail_version.stories.tsx

@@ -0,0 +1,21 @@
+import React from 'react';
+import { Pattern, generateDocs } from 'storybook-django/src/react';
+
+import template from './whats_new_in_wagtail_version.html';
+
+const { docs, argTypes } = generateDocs(template);
+
+export default {
+  title: 'Home / New in Wagtail',
+  parameters: { docs },
+  argTypes: { ...argTypes },
+};
+
+const Template = (args) => <Pattern filename={__filename} context={args} />;
+
+export const Base = Template.bind({});
+Base.args = {
+  version: '99',
+  dismissible_id: 'aabbcc',
+  editor_guide_link: 'https://guide.wagtail.org/',
+};

+ 21 - 0
wagtail/admin/templates/wagtailadmin/shared/help_block.stories.tsx

@@ -0,0 +1,21 @@
+import React from 'react';
+import { Pattern, generateDocs } from 'storybook-django/src/react';
+
+import template from './help_block.html';
+
+const { docs, argTypes } = generateDocs(template);
+
+export default {
+  parameters: { docs },
+  argTypes: { ...argTypes },
+};
+
+const HelpBlock = (props) => <Pattern filename={__filename} context={props} />;
+
+export const Base = () => (
+  <>
+    <HelpBlock status="info">Help block info message</HelpBlock>
+    <HelpBlock status="warning">Help block warning message</HelpBlock>
+    <HelpBlock status="critical">Help block critical message</HelpBlock>
+  </>
+);

+ 6 - 1
wagtail/test/settings_ui.py

@@ -18,7 +18,12 @@ PATTERN_LIBRARY = {
     # Groups of templates for the pattern library navigation. The keys
     # are the group titles and the values are lists of template name prefixes that will
     # be searched to populate the groups.
-    "SECTIONS": (("components", ["wagtailadmin/shared", "wagtailadmin/panels"]),),
+    "SECTIONS": (
+        (
+            "components",
+            ["wagtailadmin/shared", "wagtailadmin/panels", "wagtailadmin/home"],
+        ),
+    ),
     # Configure which files to detect as templates.
     "TEMPLATE_SUFFIX": ".html",
     "PATTERN_BASE_TEMPLATE_NAME": "",