🎨 style: adjust wavy border and add layout wavy border
This commit is contained in:
parent
62734308fc
commit
d5e21fa872
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
13
packages/frontend/public/wave-border-layout.svg
Normal file
13
packages/frontend/public/wave-border-layout.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 26 KiB |
@ -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>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user