import * as React from "react"; import styled from "styled-components"; import Linkify from "linkify-react"; import { Flex, Box, Text } from "rimble-ui"; import { StarBorder, CallSplit, Send } from "@rimble/icons"; import { SchemaDataResponse, SchemaDataInput } from "./types"; import { fonts, colors } from "../../../themes"; import { SchemaHeader } from "./SchemaHeader"; const Wrapper = styled(Flex)` ${(props) => props.onClick && ` cursor: pointer; &:hover { border-color: ${colors.primary.base}; } `} `; const IconWrap = styled(Box)` svg { vertical-align: text-bottom; } `; const GitHubLink = styled.a` text-decoration: none; color: ${colors.silver}; &:hover { color: ${colors.primary.base}; } `; export interface SchemaCardProps { schema: SchemaDataResponse | SchemaDataInput; style?: any; className?: string; onClick?(): void; } export const SchemaCard: React.FunctionComponent = (props) => { const { schema, className, style, onClick } = props; return ( {"favoriteCount" in schema && ( {schema.favoriteCount} 0 0 )} {schema.description && ( event.stopPropagation()}> {schema.description} )} {"creator" in schema && schema.creator ? ( event.stopPropagation()} > {schema.creator.name || schema.creator.nickName} ) : ( )} {"updated" in schema && ( {new Date(schema.updated).toLocaleDateString()} )} ); };