♻️ refactor: WavyBorder component and update CreateProjectLayout
This commit is contained in:
parent
392377d6ae
commit
7dbfe03555
@ -1,20 +1,19 @@
|
|||||||
import React, { ComponentPropsWithoutRef, useMemo } from 'react';
|
import React, { ComponentPropsWithoutRef, useMemo } from 'react';
|
||||||
import { cn } from 'utils/classnames';
|
import { cn } from 'utils/classnames';
|
||||||
|
|
||||||
type WavyBorderType = 'card' | 'layout';
|
type WaveBorderVariant = 'card' | 'layout';
|
||||||
|
|
||||||
export interface WavyBorderProps extends ComponentPropsWithoutRef<'div'> {
|
export interface WavyBorderProps extends ComponentPropsWithoutRef<'div'> {
|
||||||
type?: WavyBorderType;
|
variant?: WaveBorderVariant;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WavyBorder = ({
|
export const WavyBorder = ({
|
||||||
className,
|
className,
|
||||||
children,
|
variant = 'card',
|
||||||
type = 'card',
|
|
||||||
...props
|
...props
|
||||||
}: WavyBorderProps) => {
|
}: WavyBorderProps) => {
|
||||||
const imageSrc = useMemo(() => {
|
const imageSrc = useMemo(() => {
|
||||||
switch (type) {
|
switch (variant) {
|
||||||
case 'card':
|
case 'card':
|
||||||
return '/wave-border-card.svg';
|
return '/wave-border-card.svg';
|
||||||
case 'layout':
|
case 'layout':
|
||||||
@ -22,17 +21,15 @@ export const WavyBorder = ({
|
|||||||
default:
|
default:
|
||||||
return '/wave-border-card.svg';
|
return '/wave-border-card.svg';
|
||||||
}
|
}
|
||||||
}, [type]);
|
}, [variant]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
{...props}
|
{...props}
|
||||||
className={cn('w-full h-1 bg-repeat-x bg-top bg-cover', className)}
|
className={cn('w-full bg-repeat-x h-1 bg-top bg-cover', className)}
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(${imageSrc})`,
|
backgroundImage: `url(${imageSrc})`,
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -25,11 +25,11 @@ export const CreateProjectLayout = ({
|
|||||||
</Heading>
|
</Heading>
|
||||||
<Link to={`/${orgSlug}`}>
|
<Link to={`/${orgSlug}`}>
|
||||||
<Button iconOnly variant="tertiary">
|
<Button iconOnly variant="tertiary">
|
||||||
<CrossIcon />
|
<CrossIcon size={18} />
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<WavyBorder type="layout" />
|
<WavyBorder variant="layout" />
|
||||||
</div>
|
</div>
|
||||||
<section className="px-6 h-full flex-1 py-6 overflow-y-auto">
|
<section className="px-6 h-full flex-1 py-6 overflow-y-auto">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
|
Loading…
Reference in New Issue
Block a user