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

Breadcrumb design. DDFFORM-608 #618

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/stories/Library/article-header/article-header.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.article-header {
@include layout-container;
@include block-spacing();
display: grid;
gap: $s-xl;
position: relative;
margin-top: $s-lg;

@include media-query__small {
margin-bottom: $s-4xl;
Expand Down
12 changes: 8 additions & 4 deletions src/stories/Library/breadcrumb/Breadcrumb.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ const StoryBase: StoryBaseType<BreadcrumbProps> = {
component: BreadcrumbComp,
decorators: [withDesign],
argTypes: {
text: {
defaultValue: "Nyheder",
items: {
defaultValue: [
{ text: "Nyheder" },
{ text: "Pressemeddelser", link: "/" },
{ text: "Page" },
{ text: "Article", link: "/" },
],
},
},
parameters: {
design: {
type: "figma",
url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?node-id=437%3A4681",
url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=15294-35432&mode=design&t=yVa9YIJSSytj3Ta6-4",
},
layout: "centered",
},
};

Expand Down
22 changes: 11 additions & 11 deletions src/stories/Library/breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { IconArrow } from "../Arrows/icon-arrow-ui/ArrowUI";

export type BreadcrumbProps = {
text: string;
items: { link?: string; text: string }[];
};
export const Breadcrumb = ({ text }: BreadcrumbProps) => {
export const Breadcrumb = ({ items }: BreadcrumbProps) => {
return (
<div className="breadcrumb">
<IconArrow size="small" direction="left" hover>
<a href="/" className="arrow__link" aria-label="Arrow link">
<p className="text-links">{text}</p>
</a>
</IconArrow>
</div>
<nav className="breadcrumb" role="navigation">
{items.map((item) => {
return item.link ? (
<a href={item.link}>{item.text}</a>
) : (
<span>{item.text}</span>
);
})}
</nav>
);
};
43 changes: 31 additions & 12 deletions src/stories/Library/breadcrumb/breadcrumb.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
.breadcrumb {
.arrow__link {
text-decoration: none;
}
@include layout-container($layout__max-width--large);

.text-links {
color: $color__text-secondary-gray;
margin-bottom: -4px;
@include typography($typo__links);
}
display: flex;
flex-wrap: wrap;
margin-top: $s-lg;
margin-bottom: $s-lg;
row-gap: $s-sm;

.arrow__body {
stroke: $color__text-secondary-gray;
> a {
@extend %text-inline-link;
}
}

// We cannot be sure to be able to put classes directly on the children,
// as they might be atom links.
.breadcrumb > * {
@include typography($typo__body-small);

position: relative;
display: inline-block;
color: $color__text-secondary-gray;
}

// Targeting all the items that should have a > prefix.
.breadcrumb > * + * {
$_arrow-size: 20px;

padding-left: $_arrow-size;

.arrow__head {
fill: $color__global-grey;
&::before {
position: absolute;
content: ">";
left: 0;
width: $_arrow-size;
text-align: center;
}
}
Loading