-
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.
Milestone! Reactfire finally no longer necessary.
- Loading branch information
ChrisBrownie55
committed
Dec 24, 2020
1 parent
10e5c09
commit 87c7e80
Showing
28 changed files
with
1,219 additions
and
1,263 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import {FontIcon, Text} from '@fluentui/react' | ||
import {motion} from 'framer-motion' | ||
import {colors} from '../shared/theme' | ||
import '../styles/action-button-styles.css' | ||
import '../styles/action-button.css' | ||
|
||
/* | ||
* @param {{ variant: 'round' | 'flat' | 'bold-orange' | 'bold-pink', iconName: string }} options | ||
* @param {{ variant: 'round' | 'flat' | 'bold-orange' | 'bold-pink' | 'danger', iconName: string }} options | ||
*/ | ||
export function ActionButton({variant, iconName, children, className, ...props}) { | ||
return ( | ||
<motion.button | ||
<button | ||
animate | ||
className={`ActionButton ActionButton--${variant} ${children ? 'ActionButton--content' : ''} ${className || ''}`} | ||
{...props} | ||
> | ||
<FontIcon iconName={iconName} aria-hidden="true" /> | ||
{children && ( | ||
<Text as="span" variant="actionButton" style={{color: colors.realOrange}}> | ||
<Text as="span" variant="actionButton"> | ||
{children} | ||
</Text> | ||
)} | ||
</motion.button> | ||
</button> | ||
) | ||
} |
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,5 +1,13 @@ | ||
import {Stack} from '@fluentui/react' | ||
|
||
export function Center(props) { | ||
return <Stack verticalAlign="center" horizontalAlign="center" style={{height: '100%', width: '100%'}} {...props} /> | ||
const empty = {} | ||
export function Center({style = empty, ...props}) { | ||
return ( | ||
<Stack | ||
verticalAlign="center" | ||
horizontalAlign="center" | ||
style={{height: '100%', width: '100%', ...style}} | ||
{...props} | ||
/> | ||
) | ||
} |
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,94 @@ | ||
import {memo, Suspense} from 'react' | ||
|
||
import xss from 'xss' | ||
import marked from 'marked' | ||
import {motion} from 'framer-motion' | ||
import {Spinner} from '@fluentui/react' | ||
|
||
import {Center} from './center.js' | ||
import {colors} from '../shared/theme.js' | ||
import {artworkWrapperStyles} from './slideshow-parts.js' | ||
|
||
export const CharacterStory = memo(({story}) => ( | ||
<div className="Character__story" dangerouslySetInnerHTML={{__html: xss(marked(story))}} /> | ||
)) | ||
|
||
const empty = {} | ||
/** | ||
* | ||
* @param {{ | ||
* slideshow: JSX.Element, | ||
* name: JSX.Element, | ||
* story: JSX.Element, | ||
* actions: [JSX.Element], | ||
* mode: 'display' | 'edit', | ||
* onSubmit: function(React.SyntheticEvent) | ||
* }} props | ||
* @constructor | ||
*/ | ||
export function CharacterLayout({slideshow, name, story, actions, mode, onSubmit}) { | ||
const content = ( | ||
<main style={{height: 'calc(100% - 62px)'}}> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
padding: '0 0 45px 0', | ||
height: 'calc(100% - 45px)', | ||
overflowY: 'scroll', | ||
}} | ||
> | ||
<Suspense | ||
fallback={ | ||
<Center style={artworkWrapperStyles}> | ||
<Spinner label="Fetching artwork" /> | ||
</Center> | ||
} | ||
> | ||
{slideshow} | ||
</Suspense> | ||
|
||
<article style={{padding: '0 31px', display: 'flex', flexDirection: 'column', flexGrow: 1}}> | ||
{name} | ||
{story} | ||
</article> | ||
</div> | ||
<section | ||
style={{ | ||
position: 'fixed', | ||
bottom: 0, | ||
display: 'flex', | ||
justifyContent: 'space-evenly', | ||
alignItems: 'center', | ||
width: '100%', | ||
height: 62, | ||
backgroundColor: 'white', | ||
boxShadow: `${colors.lightOrange} 0 -2px 7px 0`, | ||
}} | ||
> | ||
{actions} | ||
</section> | ||
</main> | ||
) | ||
|
||
let wrapped | ||
if (mode === 'display') { | ||
wrapped = ( | ||
<motion.div layout style={{height: '100%'}}> | ||
{content} | ||
</motion.div> | ||
) | ||
} else if (mode === 'edit') { | ||
wrapped = ( | ||
<motion.div layout style={{height: '100%'}}> | ||
<form onSubmit={onSubmit} style={{display: 'inline'}}> | ||
{content} | ||
</form> | ||
</motion.div> | ||
) | ||
} else { | ||
throw new Error(`Invalid mode '${mode}' is not supported.`) | ||
} | ||
|
||
return wrapped | ||
} |
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,63 @@ | ||
import {ActionButton} from './action-button' | ||
import {colors} from '../shared/theme' | ||
|
||
export const artworkWrapperStyles = { | ||
position: 'relative', | ||
backgroundColor: colors.lightOrange, | ||
width: '100%', | ||
height: 262, | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
} | ||
export const artworkStyles = { | ||
objectFit: 'contain', | ||
maxWidth: '100%', | ||
maxHeight: '100%', | ||
} | ||
|
||
const nextButtonStyles = { | ||
position: 'absolute', | ||
bottom: 0, | ||
right: 0, | ||
width: 46, | ||
height: 46, | ||
borderRadius: 0, | ||
borderTopLeftRadius: 8, | ||
} | ||
export function NextButton(props) { | ||
return ( | ||
<ActionButton | ||
iconName="Forward" | ||
variant="round-orange" | ||
type="button" | ||
title="Next" | ||
aria-label="Next" | ||
style={nextButtonStyles} | ||
{...props} | ||
/> | ||
) | ||
} | ||
|
||
const previousButtonStyles = { | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
width: 46, | ||
height: 46, | ||
borderRadius: 0, | ||
borderBottomRightRadius: 8, | ||
} | ||
export function PreviousButton(props) { | ||
return ( | ||
<ActionButton | ||
iconName="Back" | ||
variant="round-orange" | ||
type="button" | ||
title="Previous" | ||
aria-label="Previous" | ||
style={previousButtonStyles} | ||
{...props} | ||
/> | ||
) | ||
} |
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
Oops, something went wrong.