import React, { HTMLAttributes, useMemo } from "react"; import { Colors } from "../colors"; export interface StatusProps extends HTMLAttributes { color?: Colors; withDot?: boolean; lite?: boolean; } export interface StatusDotProps { color?: Colors; animatedDot?: boolean } export interface StatusIndicatorProps { color: Colors; } export const StatusDot = ({ color, animatedDot }: StatusDotProps) => { const classes = useMemo(() => { return [ `status-dot`, color && `status-${color}`, , animatedDot && `status-dot-animated` ].filter(Boolean).join(' ') }, [color, animatedDot]); return ( ) } const Status = ({ children, className, color, withDot, animatedDot, lite, ...props }: StatusProps & StatusDotProps) => { const classes = [ 'status', color && `status-${color}`, lite && 'status-lite', className ].filter(Boolean).join(' '); return (
{withDot && } {children}
) } export const StatusIndicator = ({ color }: StatusIndicatorProps) => { return (
) } export default Status;