-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ztri 32 markdown to jsx #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very clear what SC means There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
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, | ||
}; |
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; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ export const offWhite = '#fbf9fa'; | |
export const medButtonHeight = '42px'; | ||
export const smallButtonHeight = '38px'; | ||
export const titleBarVerticalPadding = '8px'; | ||
export const mainContainerWidth = '700px'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice use of relative units |
||
|
||
// font-families | ||
export const headerFont = 'DIN, sans-serif'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see youve added another dependency interesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about dat