-
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.
Merge pull request #32 from fac19/ZTRI-32-markdown-to-jsx
Ztri 32 markdown to jsx
- Loading branch information
Showing
9 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
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,57 @@ | ||
import React, { useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
// import Markdown from 'markdown-to-jsx'; | ||
|
||
import * as SC from './style'; | ||
|
||
import WorkshopHeader from '../../WorkshopHeader/WorkshopHeader'; | ||
import BackButton from '../../buttons/BackButton'; | ||
import PrimaryButton from '../../buttons/PrimaryButton'; | ||
|
||
import getFromJSON from '../../../utils/getFromJSON'; | ||
import api from '../../../api/api'; | ||
|
||
export default function WorkshopContent({ match: { params } }) { | ||
const [errorState, setErrorState] = React.useState(''); | ||
const [workshop, setWorkshop] = React.useState({}); | ||
|
||
useEffect(() => { | ||
api | ||
.getSpecificWorkshop(params.ID) | ||
.then((res) => { | ||
setWorkshop(getFromJSON(res)); | ||
}) | ||
.catch(() => { | ||
setErrorState( | ||
<h2> | ||
<br /> | ||
<br /> | ||
This workshop couldnt be found | ||
</h2>, | ||
); | ||
}); | ||
}, [params.ID]); | ||
|
||
return ( | ||
<> | ||
<WorkshopHeader images={workshop.images} date={workshop.date_created} tags={workshop.tags} title={workshop.title} /> | ||
<SC.MainContainer> | ||
{/* <Markdown>{workshop.content}</Markdown> */} | ||
<p>{workshop.content}</p> | ||
<SC.ButtonsWrapper> | ||
<BackButton /> | ||
<PrimaryButton innerText="DOWNLOAD ALL" /> | ||
</SC.ButtonsWrapper> | ||
{errorState} | ||
</SC.MainContainer> | ||
</> | ||
); | ||
} | ||
|
||
WorkshopContent.propTypes = { | ||
match: PropTypes.shape({ | ||
params: PropTypes.shape({ | ||
ID: PropTypes.string, | ||
}), | ||
}).isRequired, | ||
}; |
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 styled from 'styled-components'; | ||
import * as vars from '../../../styles/variables'; | ||
|
||
export const MainContainer = styled.section` | ||
display: flex; | ||
flex-direction: column; | ||
max-width: ${vars.mainContainerWidth}; | ||
margin: 0 auto; | ||
`; | ||
|
||
export const ButtonsWrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
`; |
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
File renamed without changes.