Skip to content

Commit

Permalink
feat(web): add basics of Header and Footer
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrad77 committed Dec 11, 2024
1 parent 5bb4f63 commit 72b1a93
Show file tree
Hide file tree
Showing 13 changed files with 569 additions and 287 deletions.
39 changes: 1 addition & 38 deletions apps/web/src/App.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
#root {
max-width: 1280px;
/* max-width: 1280px; */
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}
158 changes: 22 additions & 136 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,143 +1,29 @@
import { useState } from "react";
import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";
import { BaseWrapper } from "./components/BaseComponents/BaseWrapper";
import "./App.css";
import { FaSignInAlt } from "react-icons/fa";
import { Button } from "./components";
// import reactLogo from './assets/react.svg';
// import viteLogo from '/vite.svg';
// import { FaSignInAlt } from 'react-icons/fa';
// import { Button } from './components';

function App() {
const [count, setCount] = useState(0);

return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
<div
style={{
display: "flex",
flexWrap: "wrap",
gap: "10px",
backgroundColor: "#AAA",
padding: "20px",
}}
>
<Button
label="متن دکمه"
color="primary"
variant="solid"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="primary"
variant="outline"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="primary"
variant="text"
icon={<FaSignInAlt />}
/>

<Button
label="متن دکمه"
color="secondary"
variant="solid"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="secondary"
variant="outline"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="secondary"
variant="text"
icon={<FaSignInAlt />}
/>

<Button
label="متن دکمه"
color="black"
variant="solid"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="black"
variant="outline"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="black"
variant="text"
icon={<FaSignInAlt />}
/>

<Button
label="متن دکمه"
color="white"
variant="solid"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="white"
variant="outline"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
color="white"
variant="text"
icon={<FaSignInAlt />}
/>

<Button
label="متن دکمه"
disabled={true}
color="primary"
variant="solid"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
disabled={true}
color="primary"
variant="outline"
icon={<FaSignInAlt />}
/>
<Button
label="متن دکمه"
disabled={true}
color="primary"
variant="text"
icon={<FaSignInAlt />}
/>
</div>
</>
<BaseWrapper
headerProps={{
navLinks: [
{ label: "رزرو خودرو", href: "#" },
{ label: "خدمات ما", href: "#" },
{ label: "بلاگ", href: "#" },
{ label: "درباره ما", href: "#" },
{ label: "تماس با ما", href: "#" },
],
user: {
name: "اولدوز بهاور",
avatarUrl: "https://via.placeholder.com/64",
},
}}
>
Hello!
</BaseWrapper>
);
}

Expand Down
20 changes: 20 additions & 0 deletions apps/web/src/components/BaseComponents/BaseWrapper.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.base-wrapper {
display: flex;
flex-direction: column;
min-height: 100vh;
width: 100vw;
}

.base-wrapper__content {
flex: 1;
padding: 16px;
background-color: #f5f5f5;
}

.base-wrapper__footer {
padding: 16px;
background-color: #1976d2;
color: white;
text-align: center;
font-size: 14px;
}
23 changes: 23 additions & 0 deletions apps/web/src/components/BaseComponents/BaseWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react";
import { Header, HeaderProps } from "../Header/Header";
import { Footer } from "../Footer/Footer";
import "./BaseWrapper.css";

export interface BaseWrapperProps {
/** Header configuration */
headerProps: HeaderProps;
/** Main content of the page */
children: React.ReactNode;
}

const BaseWrapper: React.FC<BaseWrapperProps> = ({ headerProps, children }) => {
return (
<div className="base-wrapper">
<Header {...headerProps} />
<main className="base-wrapper__content">{children}</main>
<Footer />
</div>
);
};

export { BaseWrapper };
Loading

0 comments on commit 72b1a93

Please sign in to comment.