Skip to content

Commit

Permalink
Merge pull request #610 from danskernesdigitalebibliotek/feature/DDFL…
Browse files Browse the repository at this point in the history
…SBP-543-se-vaerkvisningssiden-tilfojelse-af-metadata-under-se-detaljer-og-under-udgaver-detaljer

Added list type to ListDescription values [DDFLSBP-543]
  • Loading branch information
clausbruun authored May 22, 2024
2 parents 12dcfdf + d7e364f commit a77db2d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/stories/Library/Lists/list-description/ListDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { generateId } from "../../horizontal-term-line/HorizontalTermLine";
export type ListData = {
[k: string]: {
value: string[];
type: "standard" | "link";
type: "standard" | "link" | "list";
layout?: "default" | "column";
};
};
Expand All @@ -27,12 +27,27 @@ const ListDescription: React.FC<{ data: ListData; className?: string }> = ({
layout === "column" && "list-description__value--column"
)}
>
{value.map((val) => (
<Fragment key={val}>
{type === "standard" && <span>{val}</span>}
{type === "link" && <span className="link-tag">{val}</span>}
</Fragment>
))}
{type === "standard" &&
value.map((val) => (
<Fragment key={val}>
<span>{val}</span>
</Fragment>
))}

{type === "link" &&
value.map((val) => (
<Fragment key={val}>
<span className="link-tag">{val}</span>
</Fragment>
))}

{type === "list" && (
<ul className="list-description__value--list">
{value.map((val) => (
<li key={val}>{val}</li>
))}
</ul>
)}
</dd>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ const fakeData: ListData = {
type: "standard",
layout: "column",
},
Indhold: {
value: [
"Something to Do",
"Lie to Me",
"People Are People",
"It Doesn't Matter",
"Stories of Old",
"Somebody",
"Master and Servant",
"If You Want",
"Blasphemous Rumours",
],
type: "list",
},
};

export default fakeData;
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ dl.list-description {
flex-direction: column;
}

.list-description__value--list {
list-style: initial;
padding-left: $s-md;
}

.link-tag {
@include typography($typo__small-caption);

Expand Down

0 comments on commit a77db2d

Please sign in to comment.