import React from "react"; import { styled, useTheme } from "styled-components"; /* eslint-disable import/no-unresolved */ import { Meta } from "@storybook/react/types-6-0"; import Box from "../Box/Box"; import Heading from "../Heading/Heading"; import CardRibbon from "./CardRibbon"; import UIKitCardHeader from "./CardHeader"; import CardBody from "./CardBody"; import CardFooter from "./CardFooter"; import Card from "./Card"; const Row = styled.div` margin-bottom: 32px; `; export default { title: "Components/Card", component: Card, argTypes: {}, } as Meta; export const Default: React.FC = () => { return (
Body Footer Active Footer Success Footer Warning Footer Disabled Footer
); }; export const CardHeader: React.FC = () => { const theme = useTheme(); // This is example how to make card header "overlap" the border. // Seems to be easiest solution that works on all screens and does not rely on absolute positioning trickery const headerHeight = "60px"; const customHeadingColor = "#7645D9"; const gradientStopPoint = `calc(${headerHeight} + 1px)`; const borderBackground = `linear-gradient(${customHeadingColor} ${gradientStopPoint}, ${theme.colors.cardBorder} ${gradientStopPoint})`; // Gradient overlap is also possible, just put the "dividing" gradient first and after that the header gradient const gradientBorderColor = `linear-gradient(transparent ${gradientStopPoint}, ${theme.colors.cardBorder} ${gradientStopPoint}), ${theme.colors.gradientCardHeader}`; return (
Custom overlapping Header The border on sides of header is covered Footer Gradient overlapping Header The border on sides of header is covered Footer Card Header Body Footer Card Header Body Footer Card Header Body Footer Card Header Body Footer
); }; export const CustomBackground: React.FC = () => { return (
Custom background
); }; export const Ribbon: React.FC = () => { return (
}>
Body }> Ribbons will truncate when text is too long }> Card }> Any Color in the theme }> Any Color in the theme
); };