Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Hero widget - Set default screen size to 'small' - Update React to match other apps - Add Hero component - Add background - Add about link and intro - Add workflow loader * Filter complete workflows, only get relevant fields - Filter workflows response to only include requested fields - Filter workflows response to only include incomplete workflows - Move translations request to work in series, as `activeWorkflows` may include redundant translations and these can get big - Create a map of display names, rather than do an array search for performance * Don't read background out to screenreaders * Improve propType checking * Use paragraph for intro text * move error message to en.json * test url construction in workflow select button * remove leftover debug * limit max-height of hero image * add tests * Make Hero widget responsive with SSR (#1116) * Make Hero widget responsive with SSR - Install @artsy/fresnel - Move grommet theme merger to its own helper - Add fresnel helper components - Add media queries to Hero widget - Update tests * Update packages/app-project/src/helpers/theme/README.md Co-Authored-By: Jim O'Donnell <jim@zooniverse.org> * Add per-layout tests * start async component tests * add remaining tests * refactor tests * Resize arrow * Remove unused const * lint
- Loading branch information
1 parent
6c0f302
commit 175010f
Showing
45 changed files
with
1,214 additions
and
39 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,5 @@ | ||
# Theme | ||
|
||
Creates a Grommet theme by performing a deep merge of the Grommet base theme with the Zooniverse custom Grommet theme. | ||
|
||
This was originally done in the `GrommetWrapper` theme, but was moved here so it can be reused with `@artsy/fresnel` to extract the breakpoints for responsive sizing. |
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 @@ | ||
export { default } from './theme' |
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,7 @@ | ||
import zooTheme from '@zooniverse/grommet-theme' | ||
import { base as baseTheme } from 'grommet' | ||
import merge from 'lodash/merge' | ||
|
||
const theme = merge({}, baseTheme, zooTheme) | ||
|
||
export default theme |
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
67 changes: 67 additions & 0 deletions
67
packages/app-project/src/screens/ProjectHomePage/components/Hero/Hero.js
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,67 @@ | ||
import { withResponsiveContext } from '@zooniverse/react-components' | ||
import { Box, Grid } from 'grommet' | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
|
||
import Background from './components/Background' | ||
import Introduction from './components/Introduction' | ||
import WorkflowSelector from './components/WorkflowSelector' | ||
import ContentBox from '../../../../shared/components/ContentBox' | ||
import { Media } from '../../../../shared/components/Media' | ||
|
||
const StyledContentBox = styled(ContentBox)` | ||
${props => (props.screenSize !== 'small') && ` | ||
border-color: transparent; | ||
max-height: 763px; | ||
`} | ||
` | ||
|
||
function Hero (props) { | ||
const { screenSize, workflows } = props | ||
|
||
return ( | ||
<> | ||
<Media at='default'> | ||
<Box | ||
align='stretch' | ||
background={{ | ||
dark: 'dark-1', | ||
light: 'light-1' | ||
}} | ||
direction='column' | ||
justify='between' | ||
> | ||
<Background /> | ||
<Grid margin={{ top: 'medium-neg', horizontal: 'medium' }}> | ||
<StyledContentBox gap='medium' screenSize={screenSize}> | ||
<Introduction /> | ||
<WorkflowSelector workflows={workflows} /> | ||
</StyledContentBox> | ||
</Grid> | ||
</Box> | ||
</Media> | ||
|
||
<Media greaterThan='default'> | ||
<Grid columns={['1.618fr', '1fr']} margin={{ bottom: 'medium' }}> | ||
<Background /> | ||
<StyledContentBox | ||
gap='medium' | ||
justify='between' | ||
pad='medium' | ||
screenSize={screenSize} | ||
> | ||
<Introduction /> | ||
<WorkflowSelector workflows={workflows} /> | ||
</StyledContentBox> | ||
</Grid> | ||
</Media> | ||
</> | ||
) | ||
} | ||
|
||
const DecoratedHero = withResponsiveContext(Hero) | ||
|
||
export { | ||
DecoratedHero as default, | ||
Hero | ||
} |
68 changes: 68 additions & 0 deletions
68
packages/app-project/src/screens/ProjectHomePage/components/Hero/Hero.spec.js
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,68 @@ | ||
import { shallow } from 'enzyme' | ||
import React from 'react' | ||
|
||
import { Hero } from './Hero' | ||
import Background from './components/Background' | ||
import Introduction from './components/Introduction' | ||
import WorkflowSelector from './components/WorkflowSelector' | ||
import { Media } from '../../../../shared/components/Media' | ||
|
||
describe('Component > Hero', function () { | ||
let wrapper | ||
|
||
before(function () { | ||
wrapper = shallow(<Hero screenSize='small' />) | ||
}) | ||
|
||
it('should render without crashing', function () { | ||
expect(wrapper).to.be.ok() | ||
}) | ||
|
||
describe('behaviour on small screens', function () { | ||
let mediaWrapper | ||
|
||
before(function () { | ||
mediaWrapper = wrapper.find(Media).find({ at: 'default' }) | ||
}) | ||
|
||
it('should have a layout for small screens', function () { | ||
expect(mediaWrapper).to.have.lengthOf(1) | ||
}) | ||
|
||
it('should render the `Background` component', function () { | ||
expect(mediaWrapper.find(Background)).to.have.lengthOf(1) | ||
}) | ||
|
||
it('should render the `Introduction` component', function () { | ||
expect(mediaWrapper.find(Introduction)).to.have.lengthOf(1) | ||
}) | ||
|
||
it('should render the `WorkflowSelector` component', function () { | ||
expect(mediaWrapper.find(WorkflowSelector)).to.have.lengthOf(1) | ||
}) | ||
}) | ||
|
||
describe('behaviour on larger screens', function () { | ||
let mediaWrapper | ||
|
||
before(function () { | ||
mediaWrapper = wrapper.find(Media).find({ greaterThan: 'default' }) | ||
}) | ||
|
||
it('should have a layout for larger screens', function () { | ||
expect(mediaWrapper).to.have.lengthOf(1) | ||
}) | ||
|
||
it('should render the `Background` component', function () { | ||
expect(mediaWrapper.find(Background)).to.have.lengthOf(1) | ||
}) | ||
|
||
it('should render the `Introduction` component', function () { | ||
expect(mediaWrapper.find(Introduction)).to.have.lengthOf(1) | ||
}) | ||
|
||
it('should render the `WorkflowSelector` component', function () { | ||
expect(mediaWrapper.find(WorkflowSelector)).to.have.lengthOf(1) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.