-
Notifications
You must be signed in to change notification settings - Fork 1
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
9b2a76d
commit 49ffc4b
Showing
38 changed files
with
548 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
{ | ||
"eslint.enable": true, | ||
"editor.tabSize": 2 | ||
"editor.tabSize": 2, | ||
"workbench.colorCustomizations": { | ||
"activityBar.background": "#11332B", | ||
"titleBar.activeBackground": "#17483C", | ||
"titleBar.activeForeground": "#F6FCFA" | ||
} | ||
} |
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,6 @@ | ||
module.exports = { | ||
sanity: { | ||
projectId: process.env.SANITY_PROJECT_ID || '<#< sanity.projectId >#>', | ||
dataset: process.env.SANITY_DATASET || '<#< sanity.dataset >#>', | ||
}, | ||
}; |
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,5 +1,7 @@ | ||
const componentGenerator = require('./templates/Component'); | ||
const pageGenerator = require('./templates/Page'); | ||
|
||
module.exports = function(plop) { | ||
plop.setGenerator('component', componentGenerator); | ||
plop.setGenerator('page', pageGenerator); | ||
}; |
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,40 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { getFluidGatsbyImage } from 'gatsby-source-sanity'; | ||
import { withSpacing } from '@utilities/styles/spacing'; | ||
import { figcaptionStyles } from './Figure.styles'; | ||
import clientConfig from '../../../../config/client'; | ||
|
||
import Image from '@elements/Image'; | ||
|
||
const Figure = ({ className, node }) => { | ||
console.log('Figure', node); | ||
if (!node || !node.asset || !node.asset._ref) { | ||
return null; | ||
} | ||
const fluid = getFluidGatsbyImage( | ||
node.asset._ref, | ||
{ maxWidth: 675 }, | ||
clientConfig.sanity | ||
); | ||
|
||
return ( | ||
<figure className={className}> | ||
<Image fluid={fluid} alt={node.alt} /> | ||
<figcaption css={figcaptionStyles}>{node.caption}</figcaption> | ||
</figure> | ||
); | ||
}; | ||
|
||
Figure.propTypes = { | ||
className: PropTypes.string, | ||
node: PropTypes.shape({ | ||
alt: PropTypes.string, | ||
caption: PropTypes.string, | ||
asset: PropTypes.shape({ | ||
_ref: PropTypes.string, | ||
}), | ||
}), | ||
}; | ||
|
||
export default withSpacing(Figure); |
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,9 @@ | ||
# Figure | ||
|
||
--- | ||
|
||
(description) | ||
|
||
### Usage | ||
- … | ||
- … |
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,12 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import Figure from '@constructs/Figure'; | ||
import notes from './Figure.notes.md'; | ||
|
||
storiesOf('Constructs', module).add( | ||
'Figure', | ||
() => ( | ||
<Figure /> | ||
), | ||
{ notes } | ||
); |
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 const figcaptionStyles = { textAlign: 'right' }; |
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,14 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { render } from "@testing-library/react"; | ||
|
||
import Figure from './Figure'; | ||
|
||
describe('Figure', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer | ||
.create(<Figure />) | ||
.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}); |
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 @@ | ||
import Figure from './Figure'; | ||
|
||
export default Figure; |
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
Oops, something went wrong.