Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 18 additions & 28 deletions layouts/chart-page.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { makeStyles, Theme, createStyles, Typography } from "@material-ui/core";
import { ChartInfoVm } from "core";
import { AppLayout, HeaderLayout, FooterLayout, MainChartPageLayout } from ".";
import { HeaderComponent, FooterComponent } from "common-app/components";
import ReactMarkdown from "react-markdown";

const useStyles = makeStyles((theme: Theme) =>
createStyles({
Expand Down Expand Up @@ -82,6 +83,20 @@ export const ChartPageLayout: React.FC<Props> = (props: Props) => {
const classes = useStyles(props);
const { chart } = props;

const markdownInfoSection=`
## Título
Datos sobre la gráfica
`;

const markdownDescriptionSection=`
# Descripción
${chart.longDescription}
`;

const markdownSourceSection=`
**Fuente:** [_${chart.sourceDescription}_](${chart.sourceUrl})
`;

return (
<AppLayout>
<HeaderLayout>
Expand All @@ -91,38 +106,13 @@ export const ChartPageLayout: React.FC<Props> = (props: Props) => {
<div className={classes.root}>
<section className={classes.chartSection}>{props.children}</section>
<section className={classes.chartInfoSection}>
{/* TODO: Add Markdown support for chart info */}
<Typography variant="h6" component="h1">
Título
</Typography>
<Typography variant="subtitle1" component="p">
Datos sobre la gráfica
</Typography>
<ReactMarkdown source={markdownInfoSection}/>
</section>
<section className={classes.sourceSection}>
<Typography variant="subtitle2" component="h1">
Fuente:
<a href={chart.sourceUrl} className={classes.sourceLink}>
{chart.sourceDescription}
</a>
</Typography>
<ReactMarkdown source={markdownSourceSection}/>
</section>
<section className={classes.descriptionSection}>
<Typography
variant="h4"
component="h1"
className={classes.descriptionTitle}
>
Descripción
</Typography>
{/* TODO: Add Markdown support for description */}
<Typography
variant="body1"
component="p"
className={classes.descriptionParagraph}
>
{chart.longDescription}
</Typography>
<ReactMarkdown source={markdownDescriptionSection}/>
</section>
<section className={classes.tagsSection}>
<ul className={classes.tagList}>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"next": "^9.3.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-markdown": "^4.3.1",
"topojson-client": "^3.1.0"
},
"devDependencies": {
Expand Down