import * as React from "react"; import styled, { StyledFunction } from "styled-components"; import { StoryAnchorItemProps } from "./interface"; import * as tokens from "@tokens"; import { dim } from "@dim"; import { mq } from "@tokensDir/media-query"; import { Anchor, Label } from "@Typography"; const Section: StyledFunction = styled.section; const AnchorItem = Section` align-items: center; border-bottom: 1px solid ${tokens.colorGrey15}; display: flex; flex-direction: column; justify-content: center; padding: ${dim(4)} ${dim(2)}; position: relative; &:before { background: ${tokens.colorWhite}; content: ""; height: 1px; position: absolute; bottom: -1px; width: ${dim(1)}; } &:nth-child(n + 3) { border-bottom: none; } &:nth-child(odd) { border-right: 1px solid ${tokens.colorGrey15}; } &:nth-child(odd):before { right: 0; } &:nth-child(even):before { left: 0; } ${mq.md` border-bottom: none; grid-column: ${(props: { column: string }) => props.column}; &:nth-child(odd) { border-right: none; } &:after { background: ${tokens.colorGrey15}; content: ""; height: 100%; position: absolute; right: -${dim(2)}; width: 1px; } &:last-child:after { background: ${tokens.colorWhite}; content: ""; height: 100%; position: absolute; right: -${dim(2)}; width: 1px; } `} `; export const AnchorTitle = styled(Label)` margin-top: 0; margin-bottom: ${dim(2)}; `; export const AnchorLink = styled(Anchor)` text-align: center; `; export const StoryAnchorItem: React.FC = ({ column = '', link = { url: '', text: '' }, title = '' }) => ( {title} {link.text} );