-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
8 changed files
with
167 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { footerNames } from '../printElements/Footers'; | ||
import arrayToOptions from './arrayToOptions'; | ||
import SelectField from './SelectField'; | ||
|
||
interface SelectFooterFieldProps { | ||
value: string; | ||
onChange: (value: string) => void; | ||
} | ||
|
||
function SelectFooterField({ | ||
value, onChange, | ||
}: SelectFooterFieldProps): JSX.Element { | ||
return ( | ||
<SelectField | ||
name="Footer" | ||
value={value} | ||
onChange={onChange} | ||
> | ||
<option>None</option> | ||
{ | ||
arrayToOptions(footerNames) | ||
} | ||
</SelectField> | ||
); | ||
} | ||
|
||
export default SelectFooterField; |
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,3 @@ | ||
export default interface FooterProps { | ||
itemCount: number; | ||
} |
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,45 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core'; | ||
import FooterProps from './FooterProps'; | ||
|
||
const styles = makeStyles(() => ({ | ||
footer: { | ||
display: 'flex', | ||
padding: '10mm 5mm 5mm 0', | ||
justifyContent: 'flex-end', | ||
}, | ||
footerName: { | ||
display: 'flex', | ||
width: '70mm', | ||
}, | ||
label: { | ||
flexGrow: 0, | ||
fontWeight: 'normal', | ||
paddingRight: '0.3em', | ||
}, | ||
footerBlank: { | ||
flexGrow: 1, | ||
borderBottom: '1px solid black', | ||
}, | ||
})); | ||
|
||
function FooterScore({ itemCount }: FooterProps): JSX.Element { | ||
const classes = styles(); | ||
return ( | ||
<section | ||
className={classes.footer} | ||
> | ||
<div className={classes.footerName}> | ||
<strong className={classes.label}>Score:</strong> | ||
<span className={classes.footerBlank} /> | ||
<span> | ||
out of | ||
{' '} | ||
{itemCount} | ||
</span> | ||
</div> | ||
</section> | ||
); | ||
} | ||
|
||
export default FooterScore; |
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,55 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core'; | ||
import FooterProps from './FooterProps'; | ||
|
||
const styles = makeStyles(() => ({ | ||
footer: { | ||
display: 'flex', | ||
padding: '10mm 5mm 5mm 0', | ||
justifyContent: 'flex-end', | ||
}, | ||
footerName: { | ||
display: 'flex', | ||
paddingRight: '2em', | ||
width: '70mm', | ||
}, | ||
label: { | ||
flexGrow: 0, | ||
fontWeight: 'normal', | ||
paddingRight: '0.3em', | ||
}, | ||
footerTime: { | ||
display: 'flex', | ||
width: '50mm', | ||
}, | ||
footerBlank: { | ||
flexGrow: 1, | ||
borderBottom: '1px solid black', | ||
}, | ||
})); | ||
|
||
function FooterScoreAndTime({ itemCount }: FooterProps): JSX.Element { | ||
const classes = styles(); | ||
return ( | ||
<section | ||
className={classes.footer} | ||
> | ||
<div className={classes.footerName}> | ||
<strong className={classes.label}>Score:</strong> | ||
<span className={classes.footerBlank} /> | ||
<span> | ||
out of | ||
{' '} | ||
{itemCount} | ||
</span> | ||
</div> | ||
<div className={classes.footerTime}> | ||
<strong className={classes.label}>Time:</strong> | ||
<span className={classes.footerBlank} /> | ||
<span>minutes</span> | ||
</div> | ||
</section> | ||
); | ||
} | ||
|
||
export default FooterScoreAndTime; |
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,17 @@ | ||
import FooterProps from './FooterProps'; | ||
import FooterScore from './FooterScore'; | ||
import FooterScoreAndTime from './FooterScoreAndTime'; | ||
|
||
export type FooterName = 'Score Only' | 'Score and Time'; | ||
type FooterRenderer = (props: FooterProps) => JSX.Element; | ||
|
||
export const footerNames: FooterName[] = [ | ||
'Score Only', 'Score and Time', | ||
]; | ||
|
||
const footers = new Map<string, FooterRenderer>([ | ||
['Score Only', FooterScore], | ||
['Score and Time', FooterScoreAndTime], | ||
]); | ||
|
||
export default footers; |
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