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

docs: enhance examples by replacing code blocks with the render function #810

Merged
merged 48 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0c57f69
ci: add MDX code block extractor
cheton Nov 17, 2023
e15377e
docs: update badge
cheton Nov 17, 2023
3d7ce39
docs: update box
cheton Nov 17, 2023
7c81717
docs: update checkbox-group
cheton Nov 17, 2023
bf33704
docs: update checkbox
cheton Nov 17, 2023
0261ad5
docs: update code
cheton Nov 17, 2023
b487997
docs: update divider
cheton Nov 17, 2023
837ac75
docs: remove `ControlBox` from docs
cheton Nov 17, 2023
0da8025
breaking: deprecate ControlBox
cheton Nov 17, 2023
69d483c
docs: update css-baseline
cheton Nov 17, 2023
404de63
docs: update flex
cheton Nov 17, 2023
8056020
docs: update grid
cheton Nov 17, 2023
8ecb01d
docs: update image
cheton Nov 17, 2023
bee98ba
docs: update link
cheton Nov 17, 2023
b11d550
docs: update input-base
cheton Nov 18, 2023
176a643
docs: update input-control
cheton Nov 18, 2023
1675531
docs: update input-group
cheton Nov 18, 2023
8e05062
docs: update link-button
cheton Nov 18, 2023
99bcf1f
docs: update input
cheton Nov 18, 2023
0b5e397
docs: update input-base
cheton Nov 18, 2023
9d2f185
docs: update button-base
cheton Nov 18, 2023
92a4ee9
docs: update link
cheton Nov 18, 2023
43a16bd
docs: update progress
cheton Nov 18, 2023
2917274
chore: eslint warnings and errors
cheton Nov 18, 2023
75ea88d
docs: update search-input
cheton Nov 18, 2023
acf4cf1
docs: update radio-group
cheton Nov 18, 2023
b842bdf
docs: update radio
cheton Nov 18, 2023
7feb0be
docs: update checkbox
cheton Nov 18, 2023
3fbda29
docs: update switch
cheton Nov 18, 2023
956e97b
docs: update truncate
cheton Nov 18, 2023
cca62aa
docs: update select
cheton Nov 19, 2023
93aa3e6
docs: update skeleton
cheton Nov 19, 2023
fbd6fa1
docs: update space
cheton Nov 19, 2023
a4851ac
docs: update spinner
cheton Nov 19, 2023
806fed9
docs: update stack
cheton Nov 19, 2023
2dc3b03
docs: update svg-icon
cheton Nov 19, 2023
6500441
docs: update textarea
cheton Nov 19, 2023
49f8221
docs: update text
cheton Nov 19, 2023
e13b11e
docs: update text-label
cheton Nov 19, 2023
eb356cf
docs: update visually-hidden
cheton Nov 19, 2023
123aaf2
docs: update alert
cheton Nov 20, 2023
8b6c440
docs: update pagination
cheton Nov 20, 2023
c394b50
docs: update tag
cheton Nov 20, 2023
669d811
docs: update menu
cheton Nov 20, 2023
6891ac4
docs: update theme
cheton Nov 20, 2023
5eeae72
docs: update lab
cheton Nov 20, 2023
3d0874a
docs: update getting-started and styled-system
cheton Nov 20, 2023
2664dfb
docs: update hooks
cheton Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion packages/react-docs/config/sidebar-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export const routes = [

{ title: 'LAYOUT', heading: true },
{ title: 'Box', path: 'components/box' },
//{ title: 'ControlBox', path: 'components/control-box' }, // XXX: internal use only
{ title: 'Flex', path: 'components/flex' },
{ title: 'Grid', path: 'components/grid' },
{ title: 'Space', path: 'components/space' },
Expand Down
66 changes: 66 additions & 0 deletions packages/react-docs/pages/components/alert/alert-actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Alert, Button, Flex, LinkButton, Stack, Text } from '@tonic-ui/react';
import React, { forwardRef } from 'react';

const ActionButton = forwardRef((props, ref) => (
<Button
ref={ref}
variant="secondary"
borderColor="black:primary"
color="black:primary"
sx={{
':active': {
color: 'black:primary',
},
':focus': {
color: 'black:primary',
},
':hover': {
background: 'rgba(0, 0, 0, 0.12)',
color: 'black:primary',
},
':hover:not(:focus)': {
boxShadow: 'none',
},
}}
{...props}
/>
));
ActionButton.displayName = 'ActionButton';

const App = () => (
<Stack direction="column" spacing="4x">
<Alert variant="solid" severity="warning">
<Flex justifyContent="space-between">
<Text>This is a warning alert.</Text>
<LinkButton>Learn More</LinkButton>
</Flex>
</Alert>
<Alert variant="solid" severity="error">
<Flex justifyContent="space-between" mt={-1} mb={-2}>
<Text>This is an error alert.</Text>
<ActionButton
// See above for the ActionButton component
size="sm"
>
Action Button
</ActionButton>
</Flex>
</Alert>
<Alert variant="outline" severity="warning">
<Flex justifyContent="space-between">
<Text>This is a warning alert.</Text>
<LinkButton>Learn More</LinkButton>
</Flex>
</Alert>
<Alert variant="outline" severity="error">
<Flex justifyContent="space-between" mt={-1} mb={-2}>
<Text>This is an error alert.</Text>
<Button size="sm" variant="secondary">
Action Button
</Button>
</Flex>
</Alert>
</Stack>
);

export default App;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Alert, AlertCloseButton, Collapse, Text } from '@tonic-ui/react';
import { useToggle } from '@tonic-ui/react-hooks';
import React from 'react';

const App = () => {
const [isOpen, onClose] = useToggle(true);
return (
<Collapse in={isOpen} unmountOnExit>
<Alert variant="solid" severity="success" onClose={onClose}>
<Text pr="10x">This is a success alert.</Text>
<AlertCloseButton top={3} right={7} position="absolute" data-test="alert-close-button" />
</Alert>
</Collapse>
);
};

export default App;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Alert, Collapse, Text } from '@tonic-ui/react';
import { useToggle } from '@tonic-ui/react-hooks';
import React from 'react';

const App = () => {
const [isOpen, onClose] = useToggle(true);
return (
<Collapse in={isOpen} unmountOnExit>
<Alert variant="solid" severity="success" isClosable onClose={onClose}>
<Text>This is a success alert.</Text>
</Alert>
</Collapse>
);
};

export default App;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Alert, Stack, Text } from '@tonic-ui/react';
import React from 'react';

const App = () => (
<Stack direction="column" spacing="4x">
<Alert
variant="solid"
severity="none"
background="linear-gradient(90deg, var(--tonic-colors-purple-60) 0%, var(--tonic-colors-blue-50) 100%)"
color="white:emphasis"
>
<Text>This is a promotion message</Text>
</Alert>
<Alert
variant="outline"
severity="none"
borderImageSource="linear-gradient(90deg, var(--tonic-colors-purple-60) 0%, var(--tonic-colors-blue-50) 100%)"
borderImageSlice={1}
>
<Text>This is a promotion message</Text>
</Alert>
</Stack>
);

export default App;
41 changes: 41 additions & 0 deletions packages/react-docs/pages/components/alert/formatted-text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Alert, Box, Stack, Text } from '@tonic-ui/react';
import React from 'react';

const App = () => (
<Stack direction="column" spacing="4x">
<Alert isClosable severity="success">
<Box mb="1x">
<Text fontWeight="bold">Success</Text>
</Box>
<Text mr={-36}>
This is a success alert.
</Text>
</Alert>
<Alert isClosable severity="info">
<Box mb="1x">
<Text fontWeight="bold">Info</Text>
</Box>
<Text mr={-36}>
This is an info alert.
</Text>
</Alert>
<Alert isClosable severity="warning">
<Box mb="1x">
<Text fontWeight="bold">Warning</Text>
</Box>
<Text mr={-36}>
This is a warning alert.
</Text>
</Alert>
<Alert isClosable severity="error">
<Box mb="1x">
<Text fontWeight="bold">Error</Text>
</Box>
<Text mr={-36}>
This is an error alert.
</Text>
</Alert>
</Stack>
);

export default App;
Loading
Loading