-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1535 move examples to left side drawer (#1782)
* Added button with temporary styling * Simple styling * Small changes * Second version of the Example button * Code refactor * Grid change * Added proposed changes * Small fix * Changed name to Examples * Fixed tests * Removed unnecessary check * Small formatting fix
- Loading branch information
Showing
9 changed files
with
203 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Box, Grid2, Paper, Typography } from '@mui/material'; | ||
|
||
import EXAMPLES, { useFetchExampleData } from '../../../examples/examples'; | ||
import { SimulatorType } from '../../../types/RequestTypes'; | ||
|
||
interface ExamplePanelProps { | ||
setTabsValue: (value: string) => void; | ||
} | ||
|
||
export function ExamplePanel({ setTabsValue }: ExamplePanelProps) { | ||
const fetchExampleData = useFetchExampleData(); | ||
|
||
return ( | ||
<Box sx={{ padding: 4 }}> | ||
{Object.values(SimulatorType).map(simulator => ( | ||
<Box | ||
key={simulator} | ||
sx={{ marginBottom: 4 }}> | ||
{/* Simulator Name */} | ||
<Typography | ||
variant='h5' | ||
sx={{ marginBottom: 2 }}> | ||
{simulator.toUpperCase()} | ||
</Typography> | ||
|
||
{/* Grid2 of Examples */} | ||
<Grid2 | ||
container | ||
spacing={2}> | ||
{Object.entries(EXAMPLES[simulator]).map(([exampleName, fileName]) => ( | ||
<Grid2 | ||
key={fileName} | ||
sx={{ width: 200 }}> | ||
{' '} | ||
{/* Set a fixed width here */} | ||
<Paper | ||
elevation={3} | ||
sx={{ padding: 2, textAlign: 'center', cursor: 'pointer' }} | ||
onClick={() => { | ||
fetchExampleData(fileName); | ||
// Change the tab to 'editor' after loading the example | ||
setTabsValue('editor'); | ||
}}> | ||
<Typography variant='body1'>{exampleName}</Typography> | ||
</Paper> | ||
</Grid2> | ||
))} | ||
</Grid2> | ||
</Box> | ||
))} | ||
</Box> | ||
); | ||
} |
Oops, something went wrong.