UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

1 lines 6.31 kB
{"version":3,"sources":["../../src/components/HelpwaveBadge.tsx","../../src/components/icons/Helpwave.tsx","../../src/components/layout/Tile.tsx"],"sourcesContent":["import clsx from 'clsx'\nimport { Helpwave } from './icons/Helpwave'\nimport { Tile } from './layout/Tile'\n\ntype Size = 'small' | 'large'\n\nexport type HelpwaveBadgeProps = {\n size?: Size,\n title?: string,\n className?: string,\n}\n\n/**\n * A Badge with the helpwave logo and the helpwave name\n */\nexport const HelpwaveBadge = ({\n size = 'small',\n title = 'helpwave',\n className = ''\n}: HelpwaveBadgeProps) => {\n const iconSize: number = size === 'small' ? 24 : 64\n\n return (\n <Tile\n prefix={(<Helpwave size={iconSize} />)}\n title={{ value: title, className: size === 'small' ? 'textstyle-title-lg text-base' : 'textstyle-title-xl' }}\n className={clsx(\n {\n 'px-2 py-1 rounded-md': size === 'small',\n 'px-4 py-1 rounded-md': size === 'large',\n }, className\n)}\n />\n )\n}\n","import type { SVGProps } from 'react'\nimport { clsx } from 'clsx'\n\nexport type HelpwaveProps = SVGProps<SVGSVGElement> & {\n color?: string,\n animate?: 'none' | 'loading' | 'pulse' | 'bounce',\n size?: number,\n}\n\n/**\n * The helpwave loading spinner based on the svg logo.\n */\nexport const Helpwave = ({\n color = 'currentColor',\n animate = 'none',\n size = 64,\n ...props\n}: HelpwaveProps) => {\n const isLoadingAnimation = animate === 'loading'\n let svgAnimationKey = ''\n\n if (animate === 'pulse') {\n svgAnimationKey = 'animate-pulse'\n } else if (animate === 'bounce') {\n svgAnimationKey = 'animate-bounce'\n }\n\n if (size < 0) {\n console.error('size cannot be less than 0')\n size = 64\n }\n\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 888 888\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeWidth={48}\n {...props}\n >\n <g className={clsx(svgAnimationKey)}>\n <path className={clsx({ 'animate-wave-big-left-up': isLoadingAnimation })} d=\"M144 543.235C144 423.259 232.164 326 340.92 326\" stroke={color} strokeDasharray=\"1000\" />\n <path className={clsx({ 'animate-wave-big-right-down': isLoadingAnimation })} d=\"M537.84 544.104C429.084 544.104 340.92 446.844 340.92 326.869\" stroke={color} strokeDasharray=\"1000\" />\n <path className={clsx({ 'animate-wave-small-left-up': isLoadingAnimation })} d=\"M462.223 518.035C462.223 432.133 525.348 362.495 603.217 362.495\" stroke={color} strokeDasharray=\"1000\" />\n <path className={clsx({ 'animate-wave-small-right-down': isLoadingAnimation })} d=\"M745.001 519.773C666.696 519.773 603.218 450.136 603.218 364.233\" stroke={color} strokeDasharray=\"1000\" />\n </g>\n </svg>\n )\n}\n","import type { ReactNode } from 'react'\nimport Image from 'next/image'\nimport clsx from 'clsx'\n\nexport type TileProps = {\n title: { value: string, className?: string },\n description?: { value: string, className?: string },\n prefix?: ReactNode,\n suffix?: ReactNode,\n className?: string,\n}\n\n/**\n * A component for creating a tile similar to the flutter ListTile\n */\nexport const Tile = ({\n title,\n description,\n prefix,\n suffix,\n className\n}: TileProps) => {\n return (\n <div className={clsx('row gap-x-4 w-full items-center', className)}>\n {prefix}\n <div className=\"col w-full\">\n <span className={clsx(title.className)}>{title.value}</span>\n {!!description &&\n <span className={clsx(description.className ?? 'textstyle-description')}>{description.value}</span>}\n </div>\n {suffix}\n </div>\n )\n}\n\ntype ImageLocation = 'prefix' | 'suffix'\ntype ImageSize = {\n width: number,\n height: number,\n}\n\nexport type TileWithImageProps = Omit<TileProps, 'suffix' | 'prefix'> & {\n url: string,\n imageLocation?: ImageLocation,\n imageSize?: ImageSize,\n imageClassName?: string,\n}\n\n/**\n * A Tile with an image as prefix or suffix\n */\nexport const TileWithImage = ({\n url,\n imageLocation = 'prefix',\n imageSize = { width: 24, height: 24 },\n imageClassName = '',\n ...tileProps\n}: TileWithImageProps) => {\n const image = <Image src={url} alt=\"\" {...imageSize} className={clsx(imageClassName)}/>\n return (\n <Tile\n {...tileProps}\n prefix={imageLocation === 'prefix' ? image : undefined}\n suffix={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