import React, { FunctionComponent, Fragment } from "react"; import styled from "styled-components"; import * as tokens from "@tokens"; import { FontProps, FontItemProps } from "./interface"; const StyledFont = styled.div` font-size: ${(props: FontItemProps) => props.size}; font-family: ${(props: FontItemProps) => props.font}; & + & { margin-top: 30px; } `; const orderedFonts = tokens.fontSize.tokens.sort((a, b) => { let toInt = (v: string = "") => parseInt(v.replace("px", "")); return toInt(a.value) > toInt(b.value) ? 1 : -1; }); export const FontFamily: FunctionComponent = ({ font }: FontProps) => { return ( {orderedFonts.map((size: any, i: number) => { return ( {size.value} : {font.value} ); })} ); };