Forráskód Böngészése

chore: update storybook preview ConfigProvider locale config

走鹃 3 éve
szülő
commit
6f5d60520b

+ 11 - 1
.storybook/base/preview.tsx

@@ -4,6 +4,7 @@ import React from 'react';
 import { StoryContext } from '@storybook/react';
 
 import { ConfigProvider } from '../../packages/semi-ui/index';
+import { ContextValue } from '../../packages/semi-ui/configProvider/context'
 import zh_CN from '@douyinfe/semi-ui/lib/es/locale/source/zh_CN';
 import en_GB from '@douyinfe/semi-ui/lib/es/locale/source/en_GB';
 import ko_KR from '@douyinfe/semi-ui/lib/es/locale/source/ko_KR';
@@ -77,11 +78,20 @@ const getLocale = code => {
 
 const withConfigProvider = (StoryFn: Function, context: StoryContext) => {
     const { direction, theme, language } = context.globals;
+    const { componentId } = context;
     switchMode(theme);
     const locale = getLocale(language);
+    let configProps: ContextValue = {
+        direction,
+        locale
+    };
+
+    if (['localeprovider'].includes(componentId)) {
+        configProps.locale = null;
+    }
 
     return (
-        <ConfigProvider direction={direction} locale={locale}>
+        <ConfigProvider {...configProps}>
             <StoryFn />
         </ConfigProvider>
     );

+ 2 - 5
packages/semi-ui/_base/_story/index.scss

@@ -7,9 +7,6 @@ body {
 
 
 // 给每个组件的 story 区域加个 padding,如果需要更大的 padding 可以在组件内自定义样式
-.sb-show-main.sb-main-padded {
-
-    #root {
-        padding: 20px;
-    }
+.sb-show-main.sb-main-padded > #root {
+    padding: 20px;
 }

+ 2 - 2
packages/semi-ui/checkbox/_story/checkbox.stories.js

@@ -578,9 +578,9 @@ export const CheckboxGroupCardStyle = () => (
     </CheckboxGroup>
     <br />
     <br />
-    <div>radio disabled</div>
+    <div>Checkbox disabled</div>
     <CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
-      <Checkbox value="1" disabled extra="Semi Design" style={{ width: 280 }}>
+      <Checkbox value="1" disabled extra="disabled+checked" style={{ width: 280 }}>
         多选框标题
       </Checkbox>
       <Checkbox value="2" disabled extra="disabled+unchecked" style={{ width: 280 }}>