🎨 style: adjust wavy border and add layout wavy border

This commit is contained in:
Wahyu Kurniawan 2024-02-28 12:16:30 +07:00
parent 62734308fc
commit d5e21fa872
No known key found for this signature in database
GPG Key ID: 040A1549143A8E33
3 changed files with 38 additions and 3 deletions

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,15 +1,37 @@
import React, { ComponentPropsWithoutRef } from 'react';
import React, { ComponentPropsWithoutRef, useMemo } from 'react';
import { cn } from 'utils/classnames';
export interface WavyBorderProps extends ComponentPropsWithoutRef<'div'> {}
type WavyBorderType = 'card' | 'layout';
export interface WavyBorderProps extends ComponentPropsWithoutRef<'div'> {
type?: WavyBorderType;
}
export const WavyBorder = ({
className,
children,
type = 'card',
...props
}: WavyBorderProps) => {
const imageSrc = useMemo(() => {
switch (type) {
case 'card':
return '/wave-border-card.svg';
case 'layout':
return '/wave-border-layout.svg';
default:
return '/wave-border-card.svg';
}
}, [type]);
return (
<div {...props} className={cn('wave', className)}>
<div
{...props}
className={cn('w-full h-1 bg-repeat-x bg-top bg-cover', className)}
style={{
backgroundImage: `url(${imageSrc})`,
}}
>
{children}
</div>
);