-
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.
Merge pull request #1379 from Datawheel/canon-next-0.1.5
Canon next 0.1.5
- Loading branch information
Showing
22 changed files
with
543 additions
and
300 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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import {Grid, SimpleGrid, Stack} from "@mantine/core"; | ||
import React, {useRef} from "react"; | ||
import {Viz} from "@datawheel/canon-next"; | ||
|
||
/** | ||
* CMS custom section | ||
*/ | ||
export default function CustomSection({ | ||
slug, | ||
heading, | ||
hideOptions, | ||
title, | ||
paragraphs, | ||
configOverride, | ||
loading, | ||
filters, | ||
resetButton, | ||
stats, | ||
sources, | ||
visualizations, | ||
vizHeadingLevel, | ||
updateSource, | ||
onSetVariables | ||
}) { | ||
const section = useRef(null); | ||
|
||
return ( | ||
<Grid | ||
className={`cp-section-inner cp-default-section-inner cp-${slug}-section-inner ${loading ? "is-loading" : ""}`} | ||
ref={section} | ||
my="md" | ||
> | ||
{/* sidebar */} | ||
<Grid.Col | ||
md={3} | ||
span={12} | ||
className="cp-section-content cp-default-section-caption" | ||
> | ||
<Stack spacing="sm"> | ||
{heading} | ||
{filters} | ||
{stats} | ||
{paragraphs} | ||
{sources} | ||
{resetButton} | ||
</Stack> | ||
</Grid.Col> | ||
|
||
{/* caption */} | ||
{visualizations.length | ||
? <Grid.Col | ||
md={9} | ||
span={12} | ||
className={`cp-default-section-figure${ | ||
visualizations.length > 1 ? " cp-multicolumn-default-section-figure" : "" | ||
}${ | ||
visualizations.filter( | ||
viz => viz.logic_simple && viz.logic_simple.type === "Graphic" | ||
).length ? " cp-graphic-viz-grid" : "" | ||
}`} | ||
> | ||
<SimpleGrid | ||
breakpoints={[ | ||
{minWidth: "sm", cols: 1}, | ||
{minWidth: "md", cols: visualizations.length >= 2 ? 2 : 1} | ||
]} | ||
> | ||
{visualizations.map(visualization => | ||
<Viz | ||
section={section} | ||
config={visualization} | ||
headingLevel={vizHeadingLevel} | ||
sectionTitle={title} | ||
slug={slug} | ||
hideOptions={hideOptions} | ||
configOverride={configOverride} | ||
updateSource={updateSource} | ||
onSetVariables={onSetVariables} | ||
key={visualization.id} | ||
/> | ||
)} | ||
</SimpleGrid> | ||
</Grid.Col> | ||
: ""} | ||
</Grid> | ||
); | ||
} |
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,91 @@ | ||
import {Grid, SimpleGrid, Stack, Title, Box} from "@mantine/core"; | ||
import React, {useRef} from "react"; | ||
import {Viz} from "@datawheel/canon-next"; | ||
|
||
/** | ||
* CMS custom section | ||
*/ | ||
export default function Default({ | ||
slug, | ||
heading, | ||
hideOptions, | ||
title, | ||
paragraphs, | ||
configOverride, | ||
loading, | ||
filters, | ||
resetButton, | ||
stats, | ||
sources, | ||
visualizations, | ||
vizHeadingLevel, | ||
updateSource, | ||
onSetVariables | ||
}) { | ||
const section = useRef(null); | ||
|
||
return ( | ||
<Box pos="relative"> | ||
<Title pos="absolute" fs={64} ta="center" sx={{zIndex: -1, opacity: 0.1, top: "50%", left: "50%", transform: "translate(-50%, -50%)"}}>This is a custom section</Title> | ||
<Grid | ||
className={`cp-section-inner cp-default-section-inner cp-${slug}-section-inner ${loading ? "is-loading" : ""}`} | ||
ref={section} | ||
my="md" | ||
> | ||
|
||
{/* sidebar */} | ||
<Grid.Col | ||
md={3} | ||
span={12} | ||
className="cp-section-content cp-default-section-caption" | ||
> | ||
<Stack spacing="sm"> | ||
{heading} | ||
{filters} | ||
{stats} | ||
{paragraphs} | ||
{sources} | ||
{resetButton} | ||
</Stack> | ||
</Grid.Col> | ||
|
||
{/* caption */} | ||
{visualizations.length | ||
? <Grid.Col | ||
md={9} | ||
span={12} | ||
className={`cp-default-section-figure${ | ||
visualizations.length > 1 ? " cp-multicolumn-default-section-figure" : "" | ||
}${ | ||
visualizations.filter( | ||
viz => viz.logic_simple && viz.logic_simple.type === "Graphic" | ||
).length ? " cp-graphic-viz-grid" : "" | ||
}`} | ||
> | ||
<SimpleGrid | ||
breakpoints={[ | ||
{minWidth: "sm", cols: 1}, | ||
{minWidth: "md", cols: visualizations.length >= 2 ? 2 : 1} | ||
]} | ||
> | ||
{visualizations.map(visualization => | ||
<Viz | ||
section={section} | ||
config={visualization} | ||
headingLevel={vizHeadingLevel} | ||
sectionTitle={title} | ||
slug={slug} | ||
hideOptions={hideOptions} | ||
configOverride={configOverride} | ||
updateSource={updateSource} | ||
onSetVariables={onSetVariables} | ||
key={visualization.id} | ||
/> | ||
)} | ||
</SimpleGrid> | ||
</Grid.Col> | ||
: ""} | ||
</Grid> | ||
</Box> | ||
); | ||
} |
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 @@ | ||
import CustomSection from "./CustomSection"; | ||
import Default from "./Default"; | ||
export default { | ||
CustomSection, | ||
Default | ||
}; |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["./*"] | ||
"@/*": ["./*"], | ||
} | ||
} | ||
} |
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,7 +1,7 @@ | ||
module.exports = { | ||
i18n: { | ||
defaultLocale: "default", | ||
locales: ["default", "en", "es"] | ||
locales: ["default", "en", "ar"] | ||
}, | ||
trailingSlash: true | ||
}; |
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,5 @@ | ||
const {i18n} = require("./next-i18next.config"); | ||
|
||
const nextConfig = { | ||
i18n, | ||
reactStrictMode: true | ||
|
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
File renamed without changes.
File renamed without changes.
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
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,4 @@ | ||
|
||
export default function Table() { | ||
return <div>Table</div>; | ||
} |
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.