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

Feat/footer update #757

Merged
merged 7 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
47 changes: 27 additions & 20 deletions packages/components-css/footer/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,42 @@
* Copyright (c) 2021 Community for NL Design System
*/
.rhc-footer {
background-color: var(--utrecht-page-footer-background-color);
color: var(--utrecht-page-footer-color);
--utrecht-space-around: 1;
--utrecht-link-hover-text-decoration: underline;
--_utrecht-link-state-text-decoration-color: currentColor;
JoeriRoijenga marked this conversation as resolved.
Show resolved Hide resolved
--utrecht-column-layout-column-gap: var(--rhc-page-footer-column-gap);
--utrecht-column-layout-column-width: var(--rhc-page-footer-column-width);
--utrecht-heading-1-color: currentColor;
--utrecht-heading-2-color: currentColor;
--utrecht-heading-3-color: currentColor;
--utrecht-heading-4-color: currentColor;
--utrecht-heading-5-color: currentColor;
--utrecht-heading-6-color: currentColor;
--utrecht-page-footer-background-color: var(--rhc-color-robijnrood-500);
JoeriRoijenga marked this conversation as resolved.
Show resolved Hide resolved
--utrecht-page-footer-color: var(--rhc-color-wit);
JoeriRoijenga marked this conversation as resolved.
Show resolved Hide resolved

column-gap: var(--rhc-page-footer-column-gap);
display: flex;
flex-direction: row;
gap: var(--utrecht-page-footer-gap);
justify-content: flex-start;
padding-block-end: var(--utrecht-page-footer-padding-block-end);
padding-block-start: var(--utrecht-page-footer-padding-block-start);
padding-inline-end: var(--utrecht-page-footer-padding-inline-end);
padding-inline-start: var(--utrecht-page-footer-padding-inline-start);
@media (width <= 768px) {
flex-direction: column;
}
}

.rhc-footer__title {
color: var(--utrecht-page-footer-color) !important;
.rhc-footer--filled-secondary {
--utrecht-page-footer-background-color: var(--rhc-color-lintblauw-500);
}

.rhc-footer__column--title {
--utrecht-space-around: 1;
.rhc-footer--outlined {
--utrecht-page-footer-background-color: var(--rhc-color-wit);
--utrecht-page-footer-color: var(--rhc-color-lintblauw-500);

color: var(--utrecht-page-footer-color) !important;
margin-block-end: var(--utrecht-page-footer-column-title-margin-block-end);
border-block-start-color: var(--rhc-page-footer-border-block-start-color);
border-block-start-style: var(--rhc-page-footer-border-block-start-style);
border-block-start-width: var(--rhc-page-footer-border-block-start-width);
}

.rhc-footer__column {
--utrecht-link-hover-text-decoration: underline;
--_utrecht-link-state-text-decoration-color: --utrecht-page-footer-color;
.rhc-page-footer__section {
break-inside: avoid;
}

.rhc-footer > * {
flex: 1;
}
52 changes: 31 additions & 21 deletions packages/components-react/src/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PageFooterProps, PageFooter as UtrechtPageFooter } from '@utrecht/component-library-react';
import { ColumnLayout, PageFooterProps, PageFooter as UtrechtPageFooter } from '@utrecht/component-library-react';
import clsx from 'clsx';
import { ForwardedRef, forwardRef, PropsWithChildren, ReactNode } from 'react';
import { Heading } from './Heading';
Expand All @@ -7,6 +7,7 @@ interface FooterProps extends PageFooterProps {
heading: ReactNode;
headingLevel: number;
columns?: IColumn[];
background?: 'filled-primary' | 'filled-secondary' | 'outlined';
}

interface IColumn {
Expand All @@ -18,33 +19,42 @@ const MAX_HEADING_LEVEL = 6;

export const Footer = forwardRef(
(
{ className, heading, columns, headingLevel, children, ...restProps }: PropsWithChildren<FooterProps>,
{ className, heading, columns, headingLevel, children, background, ...restProps }: PropsWithChildren<FooterProps>,
ref: ForwardedRef<HTMLDivElement>,
) => (
<UtrechtPageFooter {...restProps} className={clsx('rhc-footer', className)} ref={ref}>
<UtrechtPageFooter
{...restProps}
ref={ref}
className={clsx(
'rhc-footer',
background === 'filled-secondary' || background === 'outlined' ? `rhc-footer--${background}` : '',
className,
)}
>
{heading && (
<div className="rhc-footer__column">
<Heading className="rhc-footer__title" level={headingLevel}>
{heading}
</Heading>
</div>
<Heading className="rhc-footer__title" level={headingLevel}>
{heading}
</Heading>
)}

{columns &&
columns.map((column, index) => (
<div className="rhc-footer__column" key={index}>
<Heading
className="rhc-footer__column--title"
level={headingLevel >= MAX_HEADING_LEVEL ? MAX_HEADING_LEVEL : headingLevel + 1}
>
{column.heading}
</Heading>
{column.children}
</div>
))}
<ColumnLayout>
{columns &&
columns.map((column, index) => (
<div className="rhc-page-footer__section" key={index}>
<Heading
className="rhc-footer__column--title"
level={headingLevel >= MAX_HEADING_LEVEL ? MAX_HEADING_LEVEL : headingLevel + 1}
>
{column.heading}
</Heading>
{column.children}
</div>
))}

{children}
{children}
</ColumnLayout>
</UtrechtPageFooter>
),
);

Footer.displayName = 'Footer';
1 change: 1 addition & 0 deletions packages/storybook/src/community/footer.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const DefaultFooter: Story = {
args: {
heading: 'De Rijksoverheid. Voor Nederland',
headingLevel: 4,
background: 'filled-primary',
columns: [
{
heading: 'Service',
Expand Down
94 changes: 58 additions & 36 deletions proprietary/design-tokens/figma/figma.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -3074,44 +3074,66 @@
},
"components/footer": {
"utrecht": {
"page": {
"footer": {
"background-color": {
"value": "{rhc.color.lintblauw.500}",
"type": "color"
},
"color": {
"value": "{rhc.color.foreground.onEmphasis}",
"type": "color"
},
"padding-block-start": {
"value": "{rhc.space.600}",
"type": "spacing"
},
"padding-block-end": {
"value": "{rhc.space.600}",
"type": "spacing"
},
"padding-inline-start": {
"value": "80px",
"type": "spacing"
},
"padding-inline-end": {
"value": "80px",
"type": "spacing"
},
"gap": {
"value": "{rhc.space.300}",
"type": "spacing"
},
"column": {
"title": {
"margin-block-end": {
"value": "{rhc.space.150}",
"type": "spacing"
}
"page-footer": {
"background-color": {
"value": "{rhc.color.lintblauw.500}",
"type": "color"
},
"color": {
"value": "{rhc.color.foreground.onEmphasis}",
"type": "color"
},
"padding-block-start": {
"value": "{rhc.space.600}",
"type": "spacing"
},
"padding-block-end": {
"value": "{rhc.space.600}",
"type": "spacing"
},
"padding-inline-start": {
"value": "80px",
"type": "spacing"
},
"padding-inline-end": {
"value": "80px",
"type": "spacing"
}
}
},
"rhc": {
"page-footer": {
"column-gap": {
"value": "{rhc.space.300}",
"type": "spacing"
},
"column-width": {
"value": "200px",
"type": "sizing"
},
"column": {
"title": {
"margin-block-end": {
"value": "{rhc.space.150}",
"type": "spacing"
}
}
},
"border": {
"block-start": {
"width": {
"value": "{rhc.border-width.m}",
"type": "borderWidth"
},
"color": {
"value": "{rhc.color.robijnrood.500}",
"type": "color"
},
"style": {
"value": "solid",
"type": "borderStyle"
}
}
}
}
}
Expand Down