-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5decf3d
commit 4e7c651
Showing
35 changed files
with
723 additions
and
231 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Typography, Stack } from '@mui/material'; | ||
|
||
const TitledInputSection = ({ title, children }) => ( | ||
<Stack className="input-stack-vertical"> | ||
<div className="input-section-header"> | ||
<Typography variant="subtitle1" gutterBottom className="input-section-header-title"> | ||
{title} | ||
</Typography> | ||
</div> | ||
<Stack className="input-stack-vertical"> | ||
{children} | ||
</Stack> | ||
</Stack> | ||
); | ||
|
||
// Dynamic Configurations | ||
|
||
TitledInputSection.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
children: PropTypes.oneOfType([ | ||
PropTypes.arrayOf(PropTypes.node), | ||
PropTypes.node | ||
]).isRequired | ||
}; | ||
|
||
export default TitledInputSection; |
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,33 @@ | ||
import React from 'react'; | ||
import propTypes from 'prop-types'; | ||
import { | ||
Grid, | ||
FormGroup, | ||
FormControlLabel, | ||
Switch | ||
} from '@mui/material'; | ||
|
||
import TitledInputSection from '../Layouts/TitledInputSection'; | ||
|
||
const RenderingElements = ({ renderingElements, setElementEnabled }) => ( | ||
<TitledInputSection title="Rendering Elements"> | ||
<FormGroup row> | ||
{renderingElements.map((element, index) => ( | ||
<Grid item xs={4} key={index}> | ||
<FormControlLabel | ||
onChange={(event) => setElementEnabled(element, event.target.checked)} | ||
control={<Switch defaultChecked />} | ||
label={element} | ||
/> | ||
</Grid> | ||
))} | ||
</FormGroup> | ||
</TitledInputSection> | ||
); | ||
|
||
RenderingElements.propTypes = { | ||
renderingElements: propTypes.array.isRequired, | ||
setElementEnabled: propTypes.func.isRequired | ||
}; | ||
|
||
export default RenderingElements; |
20 changes: 12 additions & 8 deletions
20
src/client/components/Options/index.jsx → ...t/components/Options/RenderingOptions.jsx
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 |
---|---|---|
@@ -1,36 +1,40 @@ | ||
import React from 'react'; | ||
import React, { memo } from 'react'; | ||
import propTypes from 'prop-types'; | ||
|
||
import TitledSlider from '../Inputs/TitledSlider'; | ||
import RenderingSettings from './RenderingSettings'; | ||
import RenderingElements from './RenderingElements'; | ||
import TitledInputSection from '../Layouts/TitledInputSection'; | ||
|
||
const Options = ({ | ||
const RenderingOptions = ({ | ||
renderSkip, | ||
setRenderSkip, | ||
renderingElements, | ||
setElementEnabled | ||
}) => ( | ||
<> | ||
<TitledInputSection title='Rendering Options'> | ||
<TitledSlider | ||
title='Render Skip' | ||
value={renderSkip} | ||
minValue={1} | ||
maxValue={100} | ||
min={1} | ||
max={100} | ||
step={1} | ||
setValue={setRenderSkip} | ||
toolTip='Number of simulation steps to run between frames, speeds up simulation but can cause app lag.' | ||
/> | ||
<RenderingSettings | ||
</TitledInputSection> | ||
<RenderingElements | ||
renderingElements={renderingElements} | ||
setElementEnabled={setElementEnabled} | ||
/> | ||
</> | ||
); | ||
|
||
Options.propTypes = { | ||
RenderingOptions.propTypes = { | ||
renderSkip: propTypes.number.isRequired, | ||
setRenderSkip: propTypes.func.isRequired, | ||
renderingElements: propTypes.array.isRequired, | ||
setElementEnabled: propTypes.func.isRequired | ||
}; | ||
|
||
export default Options; | ||
export default memo(RenderingOptions); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.