snowballtools-base/packages/frontend/src/components/shared/WavyBorder/WavyBorder.tsx
Wahyu Kurniawan 8ee61c0c85
[T-4910: feat] Re-styling dashboard, create project layout, project template card (#135)
* 🎨 style: adjust wavy border and add layout wavy border

* ♻️ refactor: change sidebar to use `nav`

* ♻️ refactor: org slug dashboard layout

* ♻️ refactor: create project layout and restyling it

* ♻️ refactor: remove unused style

* ️ feat: restyling template card

* ️ feat: create template icon component

* ️ feat: use `h2` for layout title

* ️ feat: Add isComingSoon property to templates and handle click event in TemplateCard component

* ♻️ refactor: WavyBorder component and update CreateProjectLayout

* 🎨 style: update button medium size padding

* 🎨 style: update layout shadow and add new shadow for the template card

* ️ feat: add wavy border gradient and line svg assets

* refactor: update wavy border svg

* 🎨 style: adjust template card name and arrow also responsive of the list of template

---------

Co-authored-by: Zachery Ng <zachery.ng@gmail.com>
2024-02-28 16:22:54 +07:00

45 lines
1.0 KiB
TypeScript

import React, { ComponentPropsWithoutRef, useMemo } from 'react';
import { cn } from 'utils/classnames';
type WaveBorderVariant = 'stroke' | 'stroke-and-fill';
export interface WavyBorderProps extends ComponentPropsWithoutRef<'div'> {
variant?: WaveBorderVariant;
}
export const WavyBorder = ({
className,
variant = 'stroke',
...props
}: WavyBorderProps) => {
const imageSrc = useMemo(() => {
switch (variant) {
case 'stroke-and-fill':
return '/wavy-border-line-and-fill.svg';
case 'stroke':
default:
return '/wavy-border-line.svg';
}
}, [variant]);
return (
<div
{...props}
className={cn(className)}
style={{
// If adding background beneath the wave, we use mask
mask: `url(/wavy-border-fill.svg) repeat-x top`,
WebkitMask: `url(/wavy-border-fill.svg) repeat-x top`,
}}
>
{/* Wave */}
<div
className="h-1 w-full bg-repeat-x bg-top"
style={{
backgroundImage: `url(${imageSrc})`,
}}
/>
</div>
);
};