Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Component playground(s) to use playground library #817

Merged
merged 26 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1c48e7d
Convert ChannelValue playground to use playground library
joebochill Nov 6, 2023
7001b9b
Remove unused channelvalue files
joebochill Nov 6, 2023
82c9cae
Update to version with copy code button
joebochill Nov 8, 2023
3ce06cc
Add todo comment
joebochill Nov 8, 2023
6d80c0b
Update browsertools version
joebochill Nov 8, 2023
59b182a
Update AppBar to use utility library for playground
joebochill Dec 8, 2023
ebe8105
Update EmptyState to use playground library
joebochill Dec 8, 2023
8f04f1b
Update Hero to use playground library
joebochill Dec 12, 2023
02d7f4e
Update InfoListItem to use playground library
joebochill Dec 12, 2023
7b5cedf
Update ListItemTag to use playground library
joebochill Dec 12, 2023
4e94347
Update ThreeLiner to use playground library
joebochill Dec 12, 2023
c5295cc
Update ToolbarMenu to use playground library
joebochill Dec 12, 2023
3ceab84
Update UserMenu to use playground library
joebochill Dec 12, 2023
b079531
Update ScoreCard to use playground library
joebochill Dec 12, 2023
bd1aecd
Update DrawerHeader to use playground library
joebochill Dec 12, 2023
6bdfd03
Update DrawerSubheader to use playground library
joebochill Dec 12, 2023
ab8c203
Update DrawerFooter to use playground library
joebochill Dec 12, 2023
6872abd
Update Drawer to use playground library
joebochill Dec 12, 2023
da8b852
Update Drawer with sharedProps
joebochill Dec 12, 2023
125e6bf
Update some style issues
joebochill Dec 13, 2023
14544cc
Update DrawerNavGroup to use playground library
joebochill Dec 14, 2023
7959135
Add better defaults for theme swapping support
joebochill Dec 14, 2023
3b6bef4
Update DrawerNavItem to use playground library
joebochill Dec 14, 2023
21f2dca
Update DrawerRailItem to use playground library, remove unused files
joebochill Dec 14, 2023
cac6ae5
Revert console log from testing
joebochill Dec 14, 2023
38bea0b
Commit to trigger firebase
huayunh Dec 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1
orbs:
codecov: codecov/[email protected]
gh: circleci/[email protected]
browser-tools: circleci/[email protected].2
browser-tools: circleci/[email protected].6
jobs:
build_library:
docker:
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@brightlayer-ui/icons": "^1.11.0",
"@brightlayer-ui/icons-mui": "^3.4.0",
"@brightlayer-ui/react-components": "^6.2.0",
"@brightlayer-ui/react-doc-components": "^1.0.0-alpha.6",
"@brightlayer-ui/react-themes": "^7.1.0",
"@craco/craco": "^7.0.0",
"@emotion/react": "^11.10.8",
Expand Down
84 changes: 0 additions & 84 deletions docs/src/componentDocs/AppBar/playground/AppBarConfig.tsx

This file was deleted.

152 changes: 146 additions & 6 deletions docs/src/componentDocs/AppBar/playground/PlaygroundPage.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,157 @@
import React from 'react';
import Box from '@mui/material/Box';
import AppBarPlayground from './PropsPlayground';
import { PreviewComponent } from './PreviewComponent';
import {
InputConfig,
PreviewComponent,
CodeSnippetFunction,
getPropsToString,
getPropsMapping,
Playground,
} from '@brightlayer-ui/react-doc-components';
import Stack from '@mui/material/Stack';
import { AppBar, AppBarProps } from '@brightlayer-ui/react-components';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import { getBodyFiller, getImage } from '../../../shared';

const inputConfig: InputConfig = [
// Required Props
// NONE

// Optional Props
{
id: 'animationDuration',
type: 'number',
initialValue: 300,
defaultValue: 300,
maxValue: 1000,
minValue: 100,
valueStep: 100,
typeLabel: 'number',
description: 'Length of the collapse / expand animation (ms)',
required: false,
category: 'Optional Props',
},
{
id: 'backgroundImage',
type: 'select',
typeLabel: 'string',
description: 'Image to use as the app bar background',
initialValue: 'undefined',
options: [
{ label: 'undefined', value: 'undefined' },
{ label: 'Farm', value: 'Farm' },
],
required: false,
category: 'Optional Props',
},
{
id: 'collapsedHeight',
type: 'number',
typeLabel: `number | string`,
description: 'Height of the AppBar when collapsed',
required: false,
initialValue: 64,
minValue: 50,
maxValue: 100,
valueStep: 10,
defaultValue: 64,
category: 'Optional Props',
},
{
id: 'expandedHeight',
type: 'number',
typeLabel: `number | string`,
description: 'Height of the AppBar when expanded',
required: false,
initialValue: 200,
minValue: 100,
maxValue: 240,
valueStep: 10,
defaultValue: 200,
category: 'Optional Props',
},
{
id: 'scrollThreshold',
type: 'number',
typeLabel: `number`,
description: 'Distance to scroll before collapsing the app bar',
required: false,
initialValue: 136,
minValue: 50,
maxValue: 400,
valueStep: 10,
defaultValue: 136,
category: 'Optional Props',
},
{
id: 'variant',
type: 'select',
typeLabel: `'collapsed' | 'expanded' | 'snap'`,
description: 'Behavior of the App Bar',
required: false,
initialValue: 'snap',
defaultValue: 'snap',
options: ['collapsed', 'expanded', 'snap'],
category: 'Optional Props',
},

// Other Configuration
// NONE
];

const AppBarPreview: PreviewComponent = ({ data }) => {
const { backgroundImage, ...rest } = data as unknown as AppBarProps;
const SCROLL_CONTAINER_ID = 'BLUIAppBar-playground-scroll-container-1';
return (
<Stack alignItems={'center'} justifyContent={'center'} sx={{ width: '100%', height: '100%' }}>
<Box
sx={{
overflow: 'hidden',
width: '100%',
maxWidth: 450,
maxHeight: 400,
position: 'relative',
}}
>
<AppBar
{...rest}
backgroundImage={getImage(backgroundImage as string)}
scrollContainerId={SCROLL_CONTAINER_ID}
>
<Toolbar>
<Typography variant="h6">Title</Typography>
</Toolbar>
</AppBar>
<Box id={SCROLL_CONTAINER_ID} sx={{ height: 400, overflow: 'scroll' }}>
{getBodyFiller()}
</Box>
</Box>
</Stack>
);
};

const generateSnippet: CodeSnippetFunction = (data) =>
`<AppBar
${getPropsToString(getPropsMapping(data, inputConfig), { join: '\n\t', skip: ['backgroundImage'] })}
${
data.backgroundImage && data.backgroundImage !== 'undefined'
? `backgroundImage={'${getImage(data.backgroundImage as string) || ''}'}`
: ''
}
>
<Toolbar>
<Typography variant={'h6'}>Title</Typography>
</Toolbar>
</AppBar>`.replace(/^\s*$(?:\r\n?|\n)/gm, '');

export const AppBarPlaygroundComponent = (): JSX.Element => (
<Box
sx={{
width: '100%',
display: 'flex',
flexDirection: 'column',
height: { xs: 'calc(100vh - 105px)', sm: 'calc(100vh - 113px)' },
}}
>
<PreviewComponent />
<AppBarPlayground />
<Playground inputConfig={inputConfig} codeSnippet={generateSnippet} previewComponent={AppBarPreview} />
</Box>
);
82 changes: 0 additions & 82 deletions docs/src/componentDocs/AppBar/playground/PreviewComponent.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions docs/src/componentDocs/AppBar/playground/PropsPlayground.tsx

This file was deleted.

1 change: 0 additions & 1 deletion docs/src/componentDocs/AppBar/playground/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './PlaygroundPage';
export * from './PreviewComponent';
Loading
Loading