Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/next/components/landing/pricing-item.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Card, List } from "antd";6import { ReactNode } from "react";78import { Icon, IconName } from "@cocalc/frontend/components/icon";9import { COLORS } from "@cocalc/util/theme";10import { CSS } from "components/misc";1112import styles from "./pricing.module.css";1314interface Props {15children: ReactNode;16icon: IconName;17title: string;18style?: CSS;19active?: boolean;20onClick?: () => void;21}2223const ACTIVE_STYLE: CSS = {24outline: `2px solid ${COLORS.BLUE_D}`,25} as const;2627export default function PricingItem({28icon,29children,30title,31style,32active,33onClick,34}: Props) {35const outerStyle: CSS = {36padding: 0,37...style,38} as const;39const activeStyle: CSS = active === true ? ACTIVE_STYLE : {};40const innerStyle: CSS = { color: COLORS.GRAY_M, ...activeStyle };4142return (43<List.Item style={outerStyle} onClick={onClick}>44<Card45className={onClick != null ? styles.item : undefined}46styles={{ header: { backgroundColor: COLORS.BLUE_LLLL } }}47style={innerStyle}48type="inner"49title={50<span style={{ fontSize: "120%" }}>51<Icon name={icon} style={{ marginRight: "10px" }} />{" "}52<strong>{title}</strong>53</span>54}55>56{children}57</Card>58</List.Item>59);60}6162const STYLE: React.CSSProperties = {63marginRight: "5px",64display: "inline-block",65color: COLORS.GRAY_DD,66} as const;6768interface Line {69amount?: string | number | ReactNode;70desc?: string | ReactNode;71indent?: boolean;72}7374export function Line(props: Line) {75const { amount, desc, indent = true } = props;76if (!amount)77return (78<div>79---<b style={STYLE}> </b>80</div>81);8283let unit = "";84if (typeof desc === "string") {85if (desc?.includes("RAM") || desc?.includes("Disk")) {86unit = " GB";87} else if (desc?.includes("CPU")) {88unit = amount == 1 ? "core" : "cores";89} else if (desc == "Projects") {90unit = "simultaneously running";91} else if (desc?.includes("Overcommit")) {92unit = "x";93}94}9596const indentStyle: CSS = indent ? { width: "3em", textAlign: "right" } : {};9798return (99<div>100<b style={STYLE}>101<div style={{ display: "inline-block", ...indentStyle }}>{amount}</div>{" "}102{unit}103</b>{" "}104{desc}105</div>106);107}108109110