/** @jsx jsx */ import { css, cx, jsx } from "@emotion/core"; // import * as React from "react"; // import Image from 'react-shimmer'; // @ts-ignore import COLORS from "../../constants/colors"; import { CardAtom, // IconAtom, IconAtom, ImageAtom, TextAtom, } from "../../atoms"; const hoverableCard = css` transition: all 0.2s ease-out; box-shadow: 0px 4px 24px rgba(57, 70, 84, 0.1); :hover { transform: translateY(0px); transition: all 0.2s ease-out; box-shadow: 0px 4px 24px rgba(57, 70, 84, 0.2); } `; const beginnerColor = "#2F80ED"; const intermediateColor = "#FB529F"; const expertColor = "#7143BF"; // const starColor = '#F8BA32'; const generateColorByDifficulty = (difficulty: any) => { switch (difficulty.toUpperCase()) { case "EXPERT": return expertColor; case "INTERMEDIATE": return intermediateColor; case "BEGINNER": default: return beginnerColor; } }; const beginnerGradient = "background: linear-gradient(270deg, #645AFF 0%, #5AC4FF 100%); border-radius: 8px 8px 0px 0px;"; const intermediateGradient = "background: linear-gradient(90deg, #FB529F 0%, #FFA844 100%); border-radius: 8px 8px 0px 0px;"; const expertGradient = "background: linear-gradient(270deg, #7143BF 0%, #C86DD7 100%); border-radius: 8px 8px 0px 0px;"; const generateGradientByDifficulty = (difficulty: any) => { switch (difficulty.toUpperCase()) { case "EXPERT": return expertGradient; case "INTERMEDIATE": return intermediateGradient; case "BEGINNER": default: return beginnerGradient; } }; const renderDuration = (seconds: number): string => { if (seconds < 60) { return `${seconds} detik`; } if (seconds < 3600) { return `${(seconds / 60).toPrecision(2)} menit`; } return `${(seconds / 3600).toPrecision(2)} jam`; }; const renderStars = (rating: number): any => { return ([ = 1 ? COLORS.YELLOW.NORMAL : COLORS.BLACK.LIGHT};`)} />, = 2 ? COLORS.YELLOW.NORMAL : COLORS.BLACK.LIGHT};`)} />, = 3 ? COLORS.YELLOW.NORMAL : COLORS.BLACK.LIGHT};`)} />, = 4 ? COLORS.YELLOW.NORMAL : COLORS.BLACK.LIGHT};`)} />, = 5 ? COLORS.YELLOW.NORMAL : COLORS.BLACK.LIGHT};`)} />, ]); }; // const courseRating = (ratings: any): any => { // let rating; // if (ratings.length !== 0) { // const reducer = (accumulator: any, currentValue: any) => accumulator + currentValue; // rating = Math.floor(ratings.map((r: any) => parseInt(r.rating, 10)).reduce(reducer) / ratings.length); // } // return rating; // }; const HorizontalCourseCardMolecule = ({ // slug = '', title = "", instructor = "KODE Team", // category = { name: '', label: '' }, instructorRole = "", collaborator = "", description = "", duration = "", rating = "", reviewCounts = "", level = { name: "", label: "" }, className = "", coverImage = "", metadata = null, ActionButtonComponent = () => null, }: // ratings = [], any) => { return (
{title} {level && level.label && level.label.toUpperCase()} {description} {instructor ? (
PENGAJAR {instructor}   {instructorRole}
) : (
)} {collaborator ? (
Berkolaborasi dengan {collaborator}
) : (
)}
{duration && (
{renderDuration(duration)} waktu belajar
)} {rating && (
{renderStars(rating)} {rating.toPrecision(2)} {/* {reviewCounts} Reviews */}
)}
); }; HorizontalCourseCardMolecule.displayName = "HorizontalCourseCardMolecule"; export { HorizontalCourseCardMolecule };