Skip to content

Commit

Permalink
amend featured employers carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
seanjermey committed Oct 17, 2023
1 parent 6ea012f commit f856d3e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,59 @@ import ChevronLeft from "@/assets/ChevronLeft.svg";
import ChevronRight from "@/assets/ChevronRight.svg";
import classes from "./styles.module.scss";
import { LogoCard, Title } from "@/ui";
import { employer_helper } from "@/helpers/employer_helper";
import { getRoute } from "@/getters/getRoute";

export default function FeaturedEmployersCarousel({ className, title, visibleCount, button }) {
const items = employer_helper.fetch().filter((i) => !!i.featured);

export default function LogoCarousel({ className, title, items, visibleCount }) {
return (
<div className={clsx(className, classes.logos)}>
<div className={clsx(className, classes.employers)}>
<Container className="mw-xxl">
<Title title={title} />
<Carousel
className={classes.logos__carousel}
className={classes.employers__carousel}
controls={true}
prevIcon={<ChevronLeft width="14" height="25" />}
nextIcon={<ChevronRight width="14" height="25" />}
>
{chunk(items, visibleCount).map((items, k) => (
<Carousel.Item key={k}>
<Row>
{items.map(({ logo, name, href }, k) => (
{items.map(({ card_image, name, url_slug }, k) => (
<Col key={k} className="py-3">
<LogoCard logo={logo} name={name} href={href} />
<LogoCard logo={card_image} name={name} href={getRoute("employer", { url_slug })} />
</Col>
))}
</Row>
</Carousel.Item>
))}
</Carousel>
<div className={classes.employers__footer}>
{button && (
<a className={classes.employers__link} href={button.href}>
{button.label}
<ChevronRight width="7" height="13" className="ms-2" />
</a>
)}
</div>
</Container>
</div>
);
}

LogoCarousel.defaultProps = {
FeaturedEmployersCarousel.defaultProps = {
className: "py-5",
title: null,
items: [],
visibleCount: 5,
button: {
label: "View all our Featured Employers",
href: getRoute("employers"),
},
};

LogoCarousel.propTypes = {
FeaturedEmployersCarousel.propTypes = {
className: PropTypes.string,
title: PropTypes.string,
items: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string,
logo: PropTypes.string,
href: PropTypes.string,
})
),
visibleCount: PropTypes.number,
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "src/scss/module";

.logos {
.employers {
&__carousel {
display: flex;

Expand All @@ -25,4 +25,19 @@
order: 3;
}
}

&__footer {
text-align: right;
}

&__link {
display: inline-flex;
align-items: center;
color: var(#{--bs-primary});
text-decoration: none;

& svg {
fill: var(#{--bs-primary});
}
}
}
2 changes: 1 addition & 1 deletion src/components/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const HorizontalListings = lazy(() => import("./HorizontalListings"));
export const KeyTabListing = lazy(() => import("./KeyTabListing"));
export const LatestBlogs = lazy(() => import("./LatestBlogs"));
export const LatestJobs = lazy(() => import("./LatestJobs"));
export const LogoCarousel = lazy(() => import("./LogoCarousel"));
export const FeaturedEmployersCarousel = lazy(() => import("./FeaturedEmployersCarousel"));
export const MiniCarousel = lazy(() => import("./MiniCarousel"));
export const MultiTiles = lazy(() => import("./MultiTiles"));
export const NarrativePanel = lazy(() => import("./NarrativePanel"));
Expand Down
5 changes: 2 additions & 3 deletions src/pages/index.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ export async function getStaticProps({}) {
content: [
{ component: "QuickJobSearch", props: {} },
{
component: "LogoCarousel",
component: "FeaturedEmployersCarousel",
props: {
title: { path: "page.home.component.LogoCarousel.title", placeholder: "Featured Employers" },
items: generateArrayOf(generateLogoCard, { count: 8 }),
title: { path: "page.home.component.FeaturedEmployersCarousel.title", placeholder: "Featured Employers" },
visibleCount: 4,
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/LogoCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SourceFlowImage from "@sourceflow-uk/sourceflowimage";
export default function LogoCard({ className, logo, name, href }) {
return (
<a className={clsx(className, classes.card)} href={href}>
<SourceFlowImage className="mw-100" src={logo} size="120x120" alt={name} title={name} />
<SourceFlowImage className="mw-100" src={logo} size="228x" alt={name} title={name} />
</a>
);
}
Expand Down
13 changes: 11 additions & 2 deletions src/ui/LogoCard/styles.module.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
@import "src/scss/module";

.card {
max-width: 120px;
display: block;
width: 228px;
height: 228px;
display: flex;
justify-content: center;
align-items: center;
margin: auto;
transition: $transition-base;
border-radius: var(#{--bs-border-radius-sm});
border: 1px solid #f0f0f0;

img {
object-fit: contain;
}

&:hover {
scale: 1.05;
Expand Down

0 comments on commit f856d3e

Please sign in to comment.