From 6562cad5087e835f9032bb40a726c52663cbbb5b Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Wed, 23 Jun 2021 20:27:17 +0200 Subject: [PATCH] Components: update components provider story (#32743) * Refactor outerContext value out of story component * Add more descriptive text to Card contents * Remove unnecessary outer fragment * Move "as=div" to innerContext * Change elevation to lower value to make it easy to visually debug * Use `style` prop instead of `css` for applying CSS inline styles * Add text outline via inner context * Use new `Card` component, remove debug styles * Change innerContext background value to be different than white --- .../stories/ComponentsProvider.stories.js | 75 ++++++++++--------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/packages/components/src/ui/context/stories/ComponentsProvider.stories.js b/packages/components/src/ui/context/stories/ComponentsProvider.stories.js index c36eda233dc5f7..7f5df0ac9cb904 100644 --- a/packages/components/src/ui/context/stories/ComponentsProvider.stories.js +++ b/packages/components/src/ui/context/stories/ComponentsProvider.stories.js @@ -19,20 +19,39 @@ export default { title: 'G2 Components (Experimental)/ContextSystemProvider', }; +const outerContext = { + Card: { + isRounded: false, + elevation: 15, + }, + CardBody: { + as: 'a', + href: 'https://wordpress.org', + style: { + display: 'block', + }, + }, +}; + const innerContext = { Card: { - css: { - background: 'white', + style: { + background: 'rgba(35, 255, 55, 0.2)', }, }, + CardBody: { + as: 'div', + }, }; const InnerContent = memo( () => { const state = useSomeContext(); const isEven = state % 2 === 0; return ( - - { state } + + Card (inside innerContext) +
+ Counter:{ state }
); } ); @@ -41,7 +60,7 @@ const InnerCard = memo( () => { return ( - + @@ -53,40 +72,26 @@ export const Default = () => { const [ state, update ] = useState( 0 ); const forceUpdate = () => update( ( prev ) => prev + 1 ); - const value = { - Card: { - isRounded: false, - elevation: 100, - }, - CardBody: { - as: 'a', - href: 'https://wordpress.org', - style: { - display: 'block', - }, - }, - }; - return ( - <> - - - - - - Card - - - - - - + + + - Card + Card (inside outerContext) + + + - - + + + + Card (outside of outerContext) + + + ); };