Skip to content
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

Home Page Prep #37

Merged
merged 25 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2458f1e
initial home page prep
jtcaovan Jun 13, 2024
7e75cb8
move and export type from two column component
jtcaovan Jun 18, 2024
1ad45f1
create 2 column component for home page
jtcaovan Jun 18, 2024
b596294
rm resource count state
jtcaovan Jun 18, 2024
bb7a42f
refactor into one api call from sanity
jtcaovan Jun 18, 2024
19564ca
connect oppevent cards to sanity data
jtcaovan Jun 18, 2024
2bfb53d
fix button issue with two column content, misc changes
jtcaovan Jun 18, 2024
63eef68
refactor home page section component
jtcaovan Jun 19, 2024
c8d2fe4
add focus/active state on event cards
jtcaovan Jun 19, 2024
32a4e1a
refactor event section to use home page section
jtcaovan Jun 19, 2024
61b8175
fix small breakpoint issue with two column section
jtcaovan Jun 19, 2024
71efed6
fix prettier
jtcaovan Jun 19, 2024
d94ecb8
fix build error
jtcaovan Jun 19, 2024
2470d9c
fix build errors again
jtcaovan Jun 19, 2024
d56197a
add in category cards
jtcaovan Jun 20, 2024
db63bdd
fetch home page 2 column content
jtcaovan Jun 20, 2024
2e325c0
fix slug type
jtcaovan Jun 20, 2024
962927d
rm console.log
jtcaovan Jun 20, 2024
c893886
fix two column types
jtcaovan Jun 20, 2024
3f4366e
fix prettier/lint issues
jtcaovan Jun 20, 2024
dc3aaef
refactor see all services icon
jtcaovan Jun 20, 2024
9d789f8
update comments, address pr review comments
jtcaovan Jun 21, 2024
72ad471
add basic error handling
jtcaovan Jun 21, 2024
0a8b8a7
fix no console lint error, revert two column prop type
jtcaovan Jun 21, 2024
9660204
rm previous global button styling
jtcaovan Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions app/components/ui/Cards/CategoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ import styles from "./CategoryCard.module.scss";

interface CategoryCardProps {
label: string;
icon: string;
slug: string;
icon: {
name: string;
provider: string;
};
}

export const CategoryCard = (props: CategoryCardProps) => {
const { label, icon } = props;
const searchQuery =
label === "See all services" ? "" : encodeURIComponent(label);
const { label, icon, slug } = props;
const iconName = `${icon.provider} ${icon.name}`;

return (
<a href={`/service-finder${searchQuery}`} className={styles.categoryCard}>
<span className={`fas ${icon} ${styles.icon}`} />
<a href={`/service-finder${slug}`} className={styles.categoryCard}>
<span className={`${iconName} ${styles.icon}`} />
<p className={styles.categoryTitle}>{label}</p>
</a>
);
Expand Down
14 changes: 14 additions & 0 deletions app/components/ui/Cards/OppEventCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
position: relative;
cursor: pointer;

&:focus-within {
outline: 3px solid $color-secondary;
}

&.opportunity {
flex-direction: column;
}
Expand All @@ -36,18 +40,28 @@
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
gap: $general-spacing-md;
padding: $general-spacing-lg;
height: 100%;
width: 100%;

@media screen and (max-width: $break-tablet-p) {
padding: $general-spacing-md;

button {
justify-content: flex-start;
}
}

.contentTitle {
line-height: 125%;
margin-bottom: $general-spacing-md;

&:active,
:focus {
outline: none;
}
}

.contentTitle a {
Expand Down
5 changes: 4 additions & 1 deletion app/components/ui/Cards/OppEventCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { Button } from "components/ui/inline/Button/Button";
import styles from "./OppEventCard.module.scss";
import { OppEventDate } from "./OppEventDate";

Expand Down Expand Up @@ -32,7 +33,9 @@ export const OppEventCard = (props: OppEventCardProps) => {
</div>
</div>

<p className={styles.contentSubtext}>View more</p>
<Button arrowVariant="after" variant="linkBlue" size="lg">
View more
</Button>
</div>
</div>
);
Expand Down
5 changes: 0 additions & 5 deletions app/components/ui/Section/CategorySection.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@

.categorySection {
background-color: $color-secondary;
padding: $spacing-24 $spacing-32;

h2 {
margin-bottom: $general-spacing-s;
}

@media screen and (max-width: $break-tablet-p) {
padding: $general-spacing-xl $general-spacing-md;
}

.categoryCards {
display: grid;
grid-template-columns: repeat(4, 1fr);
Expand Down
118 changes: 61 additions & 57 deletions app/components/ui/Section/CategorySection.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,71 @@
import { HomePageSection } from "pages/HomePage/components/Section";
import React from "react";
import { CategoryCard } from "../Cards/CategoryCard";
import styles from "./CategorySection.module.scss";

const categories = [
{
label: "Arts, Culture, & Identity",
icon: "fa-palette",
},
{
label: "Childcare",
icon: "fa-baby",
},
{
label: "Education",
icon: "fa-school",
},
{
label: "Family Support",
icon: "fa-people-roof",
},
{
label: "Health & Wellness",
icon: "fa-heart-pulse",
},
{
label: "Sports & Recreation",
icon: "fa-running",
},
{
label: "Youth Workforce & Life Skills",
icon: "fa-briefcase",
},
{
label: "See all services",
icon: "fa-arrow-right",
},
];
interface Category {
icon: {
name: string;
provider: string;
};
label: string;
slug: string;
name: string;
}

/*
TODO: future PR
- Pull in title and description data
- Remove hardcoded category data
- add in background color field in sanity schema
*/
interface FeaturedCategoriesSection {
category: Category[];
name: string;
}

export interface FeaturedCategoriesData {
header: string;
subheader: string;
backgroundColor: string;
featuredCategoriesSection: FeaturedCategoriesSection[];
}

interface CategorySectionProps {
sectionData: FeaturedCategoriesData;
}

export const CategorySection = (props: CategorySectionProps) => {
const { sectionData } = props;

if (!sectionData) {
return <div>Loading...</div>;
}

const { header, subheader, backgroundColor, featuredCategoriesSection } =
sectionData;
const featuredCategories = featuredCategoriesSection[0].category;

export const CategorySection = () => {
// const {sectionData} = props;
// const {header, subheader, backgroundColor} = sectionData
return (
// <HomePageSection title={header} description={subheader} backgroundColor={backgroundColor}>
<div className={styles.categorySection}>
<div className={styles.categoryCards}>
{categories.map((category) => {
return (
<CategoryCard
key={category.label}
label={category.label}
icon={category.icon}
/>
);
})}
<HomePageSection
title={header}
description={subheader}
backgroundColor={backgroundColor}
>
<div className={styles.categorySection}>
<div className={styles.categoryCards}>
{featuredCategories.map((category) => {
return (
<CategoryCard
key={category.label}
label={category.label}
slug={category.slug}
icon={category.icon}
/>
);
})}
<CategoryCard
key="See all services"
label="See all services"
slug=""
icon={{ provider: "fas", name: "fa-arrow-right" }}
/>
</div>
</div>
</div>
// </HomePageSection>
</HomePageSection>
);
};
68 changes: 14 additions & 54 deletions app/components/ui/Section/OppEventCardSection.module.scss
Original file line number Diff line number Diff line change
@@ -1,69 +1,29 @@
@import "../../../styles/utils/_helpers.scss";

.oppEventSection {
.cardsContainer {
display: flex;
flex-direction: column;
gap: $general-spacing-xl;
overflow: hidden;
gap: $general-spacing-lg;
width: 100%;
padding: $spacing-24 $spacing-32;
height: 100%;

&.event {
background: $color-brand-dark;
}

@media screen and (max-width: $break-tablet-s) {
padding: $general-spacing-xl $general-spacing-md;
}

.oppEvent__header {
display: flex;
align-items: center;
justify-content: space-between;

h2 {
margin-bottom: $general-spacing-s;
}

&.event {
h2,
p {
color: $white;
}
}
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);

@media screen and (max-width: $break-tablet-p) {
gap: $general-spacing-s;
display: flex;
flex-direction: column;
align-items: stretch;
}
}

.cardsContainer {
display: flex;
gap: $general-spacing-lg;
width: 100%;
height: 100%;

&.event {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);

@media screen and (max-width: $break-tablet-p) {
display: flex;
flex-direction: column;
}
}

@media screen and (max-width: 1336px) {
display: grid;
grid-template-columns: repeat(2, 1fr);
}
@media screen and (max-width: 1336px) {
display: grid;
grid-template-columns: repeat(2, 1fr);
}

@media screen and (max-width: $break-tablet-p) {
display: flex;
flex-direction: column;
}
@media screen and (max-width: $break-tablet-p) {
display: flex;
flex-direction: column;
}
}
Loading
Loading