Layout Demo
This commit is contained in:
parent
4cb2909e62
commit
f9b93c4fce
10 changed files with 117 additions and 40 deletions
45
src/App.tsx
45
src/App.tsx
|
|
@ -1,14 +1,49 @@
|
|||
import './App.css'
|
||||
import Background from './components/background'
|
||||
import { useState } from "react";
|
||||
import "./App.css";
|
||||
import Background from "./components/background";
|
||||
import Commission from "./components/page/commission";
|
||||
import Link from "./components/page/link";
|
||||
import Refsheet from "./components/page/refsheet";
|
||||
import LinkRow from "./components/linkrow";
|
||||
import { Button } from "./components/common/Button";
|
||||
|
||||
function App() {
|
||||
console.log("Loading app");
|
||||
const [page, setPage] = useState("Links");
|
||||
const changePage = (page: string) => {
|
||||
setPage(page);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<Background>
|
||||
<div></div>
|
||||
<header>
|
||||
<h1>Kalon the Bee</h1>
|
||||
<LinkRow>
|
||||
<Button label="Links" onClick={() => changePage("Links")} />
|
||||
<Button
|
||||
label="Commission"
|
||||
onClick={() => changePage("Commission")}
|
||||
></Button>
|
||||
<Button
|
||||
label="Refsheet"
|
||||
onClick={() => changePage("Refsheet")}
|
||||
></Button>
|
||||
</LinkRow>
|
||||
</header>
|
||||
{page === "Links" ? (
|
||||
<Link />
|
||||
) : page === "Commission" ? (
|
||||
<Commission />
|
||||
) : page === "Refsheet" ? (
|
||||
<Refsheet />
|
||||
) : (
|
||||
<div>
|
||||
<p>Error, no page found</p>
|
||||
</div>
|
||||
)}
|
||||
</Background>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default App
|
||||
export default App;
|
||||
|
|
|
|||
|
|
@ -1,27 +1,15 @@
|
|||
import React from "react"
|
||||
import React from "react";
|
||||
|
||||
const Background: React.FC<{children: React.ReactNode }> = ({ children }) => {
|
||||
const Background: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
return (
|
||||
<div className="relative min-h-screen min-w-screen flex items-center justify-center p-4 bg-amber-500 overflow-hidden">
|
||||
<div className="absolute inset-0 flex flex-wrap justify-center items-start">
|
||||
{Array.from({ length: 20}).map((_, row) => (
|
||||
<div key={row} className="flex">
|
||||
{Array.from({ length: 10}).map((_, col) => (
|
||||
<div key={col}
|
||||
className="w-12 h-14 bg-amber-300"
|
||||
style={{
|
||||
clipPath: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
|
||||
transform: row % 2 === 0 ? "translateX(50%)" : "none",
|
||||
}}>
|
||||
<div className="relative min-h-screen min-w-screen flex items-center justify-center p-4 bg-white ">
|
||||
<div className="absolute inset-0 flex flex-wrap justify-center items-center">
|
||||
<div className="relative bg-amber-200 border-16 border-amber-500 rounded-2xl shadow-lg p-8 h-150 w-150 text-center">
|
||||
{children}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
</div>
|
||||
<div className="relative bg-white rounded-2xl shadow-lg p-8 h-100 w-200 text-center">{children}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Background
|
||||
export default Background;
|
||||
|
|
|
|||
14
src/components/common/Button.tsx
Normal file
14
src/components/common/Button.tsx
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
interface ButtonParams {
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
export const Button = ({ label, onClick }: ButtonParams) => {
|
||||
return (
|
||||
<div>
|
||||
<a className="" onClick={() => onClick()}>
|
||||
{label}
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
18
src/components/linkrow.tsx
Normal file
18
src/components/linkrow.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import React from "react";
|
||||
|
||||
const LinkRow: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
return (
|
||||
<div className="w-full p-2 flex items-center justify-between gap-2 border-2 border-amber-500 rounded-full">
|
||||
{React.Children.map(children, (child, index) => (
|
||||
<>
|
||||
{index > 0 && <div className="h-6 w-0.5 bg-amber-500" />}
|
||||
<div key={index} className="px-2">
|
||||
{child}
|
||||
</div>
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default LinkRow;
|
||||
7
src/components/page/commission.tsx
Normal file
7
src/components/page/commission.tsx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export default function Commission() {
|
||||
return (
|
||||
<div>
|
||||
<p>Commission stuff eventually</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
7
src/components/page/link.tsx
Normal file
7
src/components/page/link.tsx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export default function link() {
|
||||
return (
|
||||
<div>
|
||||
<p>Link stuff eventually</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
7
src/components/page/refsheet.tsx
Normal file
7
src/components/page/refsheet.tsx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export default function Refsheet() {
|
||||
return (
|
||||
<div>
|
||||
<p>Refsheet stuff eventually</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
color: #dfad08;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
color: #c2aa23;
|
||||
}
|
||||
|
||||
body {
|
||||
|
|
@ -33,6 +33,7 @@ body {
|
|||
}
|
||||
|
||||
h1 {
|
||||
color: #dfad08;
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
|
|
|||
14
src/main.tsx
14
src/main.tsx
|
|
@ -1,10 +1,10 @@
|
|||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.tsx'
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "./index.css";
|
||||
import App from "./App.tsx";
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
)
|
||||
</StrictMode>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue