Skip to content

Commit

Permalink
Merge pull request #939 from research-software-directory/935-software…
Browse files Browse the repository at this point in the history
…-masonry-card

932 & 935 Software overview page improvements
  • Loading branch information
dmijatovic authored Jul 11, 2023
2 parents f402d4b + e6d64b0 commit 87a81fd
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
42 changes: 42 additions & 0 deletions frontend/components/layout/ContentContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (Netherlands eScience Center)
// SPDX-FileCopyrightText: 2023 Netherlands eScience Center
//
// SPDX-License-Identifier: Apache-2.0

type ContentContainerProps = {
element?: 'section' | 'article' | 'main' | 'div'
className?: string
children: JSX.Element | JSX.Element[]
}

export default function ContentContainer(props: ContentContainerProps) {
// basic container alignment - for lg + breakpoints
const classes = `px-4 lg:container lg:mx-auto ${props.className ?? ''}`

switch (props?.element) {
case 'section':
return (
<section className={classes}>
{props.children}
</section>
)
case 'article':
return (
<article className={classes}>
{props.children}
</article>
)
case 'main':
return (
<main className={classes}>
{props.children}
</main>
)
default:
return (
<div className={classes}>
{props.children}
</div>
)
}
}
8 changes: 8 additions & 0 deletions frontend/components/software/overview/SoftwareHighlights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import ContentContainer from '~/components/layout/ContentContainer'
import {HighlightsCarousel} from './highlights/HighlightsCarousel'
import {SoftwareHighlight} from '~/components/admin/software-highlights/apiSoftwareHighlights'

Expand All @@ -20,6 +21,13 @@ export default function SoftwareHighlights({highlights}: { highlights: SoftwareH

return (
<div className="mt-8">
<ContentContainer>
<div
className="text-3xl"
>
Software Highlights
</div>
</ContentContainer>
<HighlightsCarousel items={highlights} />
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ export default function SoftwareMasonryCard({item}:SoftwareCardProps){
visibleNumberOfProgLang={visibleNumberOfProgLang}
/>
{/* Metrics */}
<SoftwareMetrics
contributor_cnt={item.contributor_cnt}
mention_cnt={item.mention_cnt}
downloads={item.downloads}
/>
<div className="flex gap-4">
<SoftwareMetrics
contributor_cnt={item.contributor_cnt}
mention_cnt={item.mention_cnt}
downloads={item.downloads}
/>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 87a81fd

Please sign in to comment.