2020-07-08 19:36:36 +02:00
|
|
|
import React from "react";
|
|
|
|
import styled from "styled-components";
|
|
|
|
import { Item, SubHeadline } from "./elements";
|
2021-03-21 18:05:24 +01:00
|
|
|
import selectedTheme from "../lib/theme";
|
2020-07-08 19:36:36 +02:00
|
|
|
|
|
|
|
const GroupContainer = styled.div`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex: 2 1 auto;
|
|
|
|
padding: 1rem 0;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Bookmark = styled.a`
|
|
|
|
font-weight: 400;
|
|
|
|
text-decoration: none;
|
|
|
|
color: ${selectedTheme.accentColor};
|
|
|
|
padding-top: 0.75rem;
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-03-05 22:00:32 +01:00
|
|
|
export interface IBookmarkProps {
|
2020-07-08 19:36:36 +02:00
|
|
|
name: string;
|
|
|
|
url: string;
|
|
|
|
}
|
|
|
|
|
2021-03-05 22:00:32 +01:00
|
|
|
export interface IBookmarkGroupProps {
|
2021-03-21 19:59:18 +01:00
|
|
|
groupName: string;
|
2021-03-05 22:00:32 +01:00
|
|
|
items: Array<IBookmarkProps>;
|
2020-07-08 19:36:36 +02:00
|
|
|
}
|
|
|
|
|
2021-03-21 19:59:18 +01:00
|
|
|
/**
|
|
|
|
* Renders a given bookmark group
|
|
|
|
* @param {IBookmarkGroupProps} props - The given props of the bookmark group
|
|
|
|
*/
|
|
|
|
export const BookmarkGroup = ({ groupName, items }: IBookmarkGroupProps) => (
|
2020-07-08 19:36:36 +02:00
|
|
|
<Item>
|
|
|
|
<GroupContainer>
|
|
|
|
<SubHeadline>{groupName}</SubHeadline>
|
|
|
|
{items.map(({ name, url }, idx) => (
|
|
|
|
<Bookmark key={[name, idx].join("")} href={url}>
|
|
|
|
{name}
|
|
|
|
</Bookmark>
|
|
|
|
))}
|
|
|
|
</GroupContainer>
|
|
|
|
</Item>
|
|
|
|
);
|