Skip to content

Commit

Permalink
Merge pull request #4 from isd-sgcu/feat/shared-border-frame
Browse files Browse the repository at this point in the history
feat: shared border frame
  • Loading branch information
punchanabu authored Jun 25, 2024
2 parents 377d1e7 + 357d84e commit fccfc01
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 2 deletions.
Binary file added public/border/darkPinkBorder.webp
Binary file not shown.
Binary file added public/border/lightPinkBorder.webp
Binary file not shown.
Binary file added public/border/transparentBorder.webp
Binary file not shown.
Binary file added public/border/whiteBrownBorder.webp
Binary file not shown.
1 change: 0 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import './globals.css';
import Image from 'next/image';

const inter = Inter({ subsets: ['latin'] });

Expand Down
12 changes: 11 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import Border from '@/components/Border';

export default function Home() {
return <main className="w-full">home</main>;
return (
<main className="w-full flex justify-center items-center flex-col p-10">
<Border variant="dark-pink">
<h1 className="text-4xl font-bold text-center text-white">
Hello, World!
</h1>
</Border>
</main>
);
}
57 changes: 57 additions & 0 deletions src/components/Border.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import darkPinkBorder from '../../public/border/darkPinkBorder.webp';
import lightPinkBorder from '../../public/border/lightPinkBorder.webp';
import whiteBrownBorder from '../../public/border/whiteBrownBorder.webp';
import transparentBorder from '../../public/border/transparentBorder.webp';

interface BorderProps {
variant: 'dark-pink' | 'light-pink' | 'white-brown' | 'transparent';
className?: string;
children?: React.ReactNode;
}

const borderStyles = {
'dark-pink': {
base: 'bg-cover bg-center',
style: {
backgroundImage: `url(${darkPinkBorder.src})`,
},
},
'light-pink': {
base: 'bg-cover bg-center opacity-70',
style: {
backgroundImage: `url(${lightPinkBorder.src})`,
},
},
'white-brown': {
base: 'bg-cover bg-center',
style: {
backgroundImage: `url(${whiteBrownBorder.src})`,
},
},
transparent: {
base: 'bg-cover bg-center opacity-70',
style: {
backgroundImage: `url(${transparentBorder.src})`,
},
},
};

const Border: React.FC<BorderProps> = ({
variant = 'dark-pink',
className,
children,
}) => {
const { base, style } = borderStyles[variant];

return (
<div
className={`flex pt-24 p-10 items-center flex-col w-[360px] h-[799px] ${base} ${className}`}
style={style}
>
{children}
</div>
);
};

export default Border;

0 comments on commit fccfc01

Please sign in to comment.