import React from "react"; import { Language } from "src/types/collections"; import { isDefined } from "src/utils/asserts"; import { formatLanguageCode, shortenEllipsis } from "src/utils/string"; import styled from "styled-components"; interface Props { language?: Language | string; title?: string; } const Container = styled.div` display: flex; place-items: center; gap: 10px; `; const Title = styled.div` font-weight: 600; font-size: 1.2rem; `; export const RowLabel = ({ language, title }: Props): JSX.Element => ( {isDefined(language) && typeof language === "string" && (
{formatLanguageCode(language)}
)} {isDefined(title) && {shortenEllipsis(title, 50)}}
);