Skip to content

Commit

Permalink
refactor: Clean up code formatting and improve layout in UseWorkshops…
Browse files Browse the repository at this point in the history
…Card and Institute components
  • Loading branch information
szweibel committed Nov 9, 2024
1 parent d5ae795 commit 86ad653
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 89 deletions.
44 changes: 20 additions & 24 deletions components/Hooks/UseWorkshopsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,44 +74,40 @@ export default function UseWorkshopCard({ workshop, gitUser, gitRepo, instUser,
}
else {
// setSrc("/images/img" + randomNumberBetween1and7 + ".jpg")
setSrc( process.env.NEXT_PUBLIC_ASSET_PREFIX
setSrc(process.env.NEXT_PUBLIC_ASSET_PREFIX
+ "/images/img" + randomNumberBetween1and7 + ".jpg")
}
}, [coverimage])

const workshopLink = './dynamic?user=' + gitUser + '&repo=' + gitRepo + '&file=' + workshop.name.split('.')[0] + '&instUser=' + instUser + '&instRepo=' + instRepo;

if(parsedWorkshop?.data?.published === false){
if (parsedWorkshop?.data?.published === false) {
console.log('not published', parsedWorkshop.data.title)
return null;
}
return (
<>
{parsedWorkshop && parsedWorkshop.data.title && parsedWorkshop.data.description && (parsedWorkshop.data.published === 'true' || !parsedWorkshop.data.published) &&
<div
style={{
maxWidth: '100vw',
}}
>
<Card
style={{
maxWidth: '100vw',
}}
className='workshop-card'>
<CardActionArea
<>
<Card
style={{
height: '450px',
maxWidth: '100vw',
}}
href={workshopLink}>
className='workshop-card'>
<CardActionArea
style={{
height: '450px',
maxWidth: '100vw',
}}
href={workshopLink}>
<div
className='stylized-image-container'>
<CardMedia
component="img"
height="240"
image={src}
alt={parsedWorkshop.data['cover title'] || parsedWorkshop.data.title}
/>
className='stylized-image-container'>
<CardMedia
component="img"
height="240"
image={src}
alt={parsedWorkshop.data['cover title'] || parsedWorkshop.data.title}
/>
</div>
<CardContent
style={{
Expand All @@ -121,12 +117,12 @@ export default function UseWorkshopCard({ workshop, gitUser, gitRepo, instUser,
><p className='centered'>{parsedWorkshop.data['cover title'] || parsedWorkshop.data.title}</p>
<h3>{parsedWorkshop.data.title}</h3>
<p
className='description'
className='description'
>{parsedWorkshop?.data?.description?.length > 200 ? parsedWorkshop.data.description.substring(0, 200) + '...' : parsedWorkshop.data.description}</p>
</CardContent>
</CardActionArea>
</Card>
</div>
</>
}
</>
)
Expand Down
6 changes: 2 additions & 4 deletions pages/inst/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ export default function Institute(props) {
<div className='inst-description'>
{parsedYAML && <p>{parsedYAML.description}</p>}
{parsedYAML && (parsedYAML.registerlink || parsedYAML.registerLink) &&
<p><Button
<Button
className='button button-bark'
href={parsedYAML.registerlink || parsedYAML.registerLink}
>{parsedYAML && (parsedYAML.registertext || parsedYAML.registerText) ? (parsedYAML.registertext || parsedYAML.registerText) : 'Register'}
</Button></p>
</Button>
}
</div>
{parsedYAML && parsedYAML.DHRIFTfrontpage === false || parsedYAML && !parsedYAML.DHRIFTfrontpage ? aboutAccordion : null}
Expand Down Expand Up @@ -258,8 +258,6 @@ export default function Institute(props) {
<Fade in={parsedYAML && parsedYAML.event || parsedYAML ? true : false}>
<Container
disableGutters={true}


sx={{
display: 'flex',
minWidth: '100%',
Expand Down
Loading

0 comments on commit 86ad653

Please sign in to comment.