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

v3 - Show Benefits by location #609

Merged
merged 5 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
12 changes: 5 additions & 7 deletions src/compensations/Compensations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
IOption,
RadioButtonGroup,
} from "src/components/forms/radioButtonGroup/RadioButtonGroup";
import BenefitsByLocation from "./components/benefitsByLocation/BenefitsByLocation";

interface CompensationsProps {
compensations: CompensationsPage;
Expand Down Expand Up @@ -93,13 +94,10 @@ const Compensations = ({ compensations, locations }: CompensationsProps) => {
) : null}
</>
)}
<div className={styles.benefits}>
{compensations.benefitsByLocation.map((benefit) => (
<div key={benefit._key} className={styles.benefitWrapper}>
{/* TODO: display benefits based on locations */}
</div>
))}
</div>
<BenefitsByLocation
anemne marked this conversation as resolved.
Show resolved Hide resolved
locationId={selectedLocation}
benefits={compensations.benefitsByLocation}
/>
</div>
);
};
Expand Down
13 changes: 0 additions & 13 deletions src/compensations/compensations.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,3 @@
padding: 10rem 5rem;
gap: 5rem;
}

.benefits {
display: flex;
flex-direction: column;
gap: 5rem;
max-width: var(--max-content-width-medium);
}

.benefitWrapper {
display: flex;
flex-direction: column;
gap: 1rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Benefit } from "studio/lib/payloads/compensations";
import Text from "src/components/text/Text";
import { RichText } from "src/components/richText/RichText";
import styles from "./benefitsByLocation.module.css";

interface BenefitsByLocationProps {
locationId: string;
benefits?: Benefit[] | any;
anemne marked this conversation as resolved.
Show resolved Hide resolved
}

export default function BenefitsByLocation({
locationId,
benefits,
}: BenefitsByLocationProps) {
const selectedBenefitsGroup =
benefits.find((location: any) => location.location._ref === locationId)
?.benefitsGroup || [];
anemne marked this conversation as resolved.
Show resolved Hide resolved

return (
<div className={styles.benefits}>
{selectedBenefitsGroup.map((benefit: Benefit) => (
<div key={benefit._key} className={styles.benefitWrapper}>
<Text type="h2">{benefit.basicTitle}</Text>
<RichText value={benefit.richText} />
</div>
))}
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.benefits {
display: flex;
flex-direction: column;
gap: 5rem;
max-width: var(--max-content-width-medium);
}

.benefitWrapper {
display: flex;
flex-direction: column;
gap: 1rem;
}