/** @jsx jsx */ import { css, jsx } from "@emotion/core"; import * as React from "react"; // @ts-ignore import COLORS from "../../constants/colors"; import { CardAtom, IconAtom, } from "../../atoms"; interface IProps { className?: any; coverImage?: string; level?: string; title?: string; badge?: string; instructor?: string; totalDuration?: number; isBookmarked?: any; onBookmark?: any; IconComponent?: any; LinkComponent?: any; css?: any; } const renderDuration = (seconds: number): string => { const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); const hourText = hours === 0 ? "" : `${hours} h`; const minuteText = minutes === 0 ? "" : `${minutes} m`; return `${hourText} ${minuteText}` }; class CourseCardMolecule extends React.PureComponent { public state = {}; public render() { const { className = "", coverImage = "", level = "", title = "", badge = "", instructor = "", totalDuration = 0, isBookmarked = false, onBookmark = () => {}, IconComponent = () => null, LinkComponent = (props: any) => props.children, } = this.props; return ( { badge && (
{badge}
) }

{level}

{title}

{instructor}

{renderDuration(totalDuration)}

{}} onClick={onBookmark ? onBookmark : () => {} } css={css` position: absolute; bottom: 20px; right: 20px; `} > {isBookmarked ? : }
) } } export { CourseCardMolecule };