Download react-page/examples/components/ExampleCustomBottomToolbar/index.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/examples/components/ExampleCustomBottomToolbar/index.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/examples/components/ExampleCustomBottomToolbar/index.tsx
-
curl -L -o index.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/examples/components/ExampleCustomBottomToolbar/index.tsx
1.23 kB
| import { Typography } from '@mui/material'; | |
| import type { BottomToolbarProps } from '@react-page/editor'; | |
| import { BottomToolbar, usePluginOfCell } from '@react-page/editor'; | |
| import React from 'react'; | |
| import CollapseButton from './CollapseButton'; | |
| /** | |
| * This is an example on how you could customize the Bottom Toolbar. | |
| * We provide most of the default components as exports, so you can also create a custom one | |
| * and use the existing pieces that you need. Check the source code for BottomToolbar | |
| */ | |
| export const ExampleCustomBottomToolbar: React.FC<BottomToolbarProps> = | |
| React.memo(({ pluginControls, ...props }) => { | |
| const [collapsed, setCollapsed] = React.useState(false); | |
| const plugin = usePluginOfCell(props.nodeId); | |
| return ( | |
| <BottomToolbar | |
| {...props} | |
| style={{ | |
| borderRadius: 20, | |
| borderColor: 'red', | |
| }} | |
| pluginControls={collapsed ? null : pluginControls} | |
| actionsLeft={[ | |
| <CollapseButton | |
| key="collapse button" | |
| collapsed={collapsed} | |
| setCollapsed={setCollapsed} | |
| />, | |
| ]} | |
| > | |
| <Typography>Custom Toolbar for {plugin?.title}</Typography> | |
| </BottomToolbar> | |
| ); | |
| }); | |