Skip to content

Commit

Permalink
Add menues
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuflatland-lf committed Jul 1, 2024
1 parent e8d4d8f commit 2526a53
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 73 deletions.
2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"@react-icons/all-files": "^4.1.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.2.1",
"react-router-dom": "^6.24.0",
"react-swipeable": "^7.0.1",
"swiper": "^11.1.4"
Expand Down
24 changes: 24 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 0 additions & 50 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,50 +0,0 @@
/* index.css */

html, body {
margin: 0;
padding: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}

.swipeable-cards-container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}

.swipeable-card {
width: 300px;
height: 400px;
margin: 10px;
background-color: #f2f2f2;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.5em;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.6s ease;
transform-style: preserve-3d;
}

.swipeable-card.flipped {
transform: rotateY(180deg);
}

.swipeable-card:active {
transform: scale(0.95);
}

.swipeable-card-content {
backface-visibility: hidden;
}

.swipeable-card-back {
position: absolute;
transform: rotateY(180deg);
backface-visibility: hidden;
}
20 changes: 5 additions & 15 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
import React from 'react';
import {Link, Route, Routes} from 'react-router-dom';
import Home from './pages/Home';
import About from './pages/About';
import './App.css'
import './App.css';
import TopMenu from './components/TopMenu';
import Menu from './components/Menu';

function App() {
return (
<>
<h1 className="text-3xl font-bold underline">Top</h1>
<nav>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/about">About</Link></li>
</ul>
</nav>
<Routes>
<Route path="/" element={<Home/>}/>
<Route path="/about" element={<About/>}/>
</Routes>
<TopMenu />
<Menu/>
</>
)
}
Expand Down
23 changes: 23 additions & 0 deletions frontend/src/components/Menu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Menu.css */

.menu {
position: fixed;
bottom: 0;
width: 100%;
background-color: #333;
display: flex;
justify-content: space-around;
padding: 22px 0;
}

.menu-button {
color: white;
background-color: transparent;
border: none;
font-size: 1em;
cursor: pointer;
}

.menu-button:hover {
color: #aaa;
}
24 changes: 24 additions & 0 deletions frontend/src/components/Menu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import {Link, Route, Routes} from 'react-router-dom';
import Home from '../pages/Home';
import About from '../pages/About';
import { IoIosHome } from "react-icons/io";
import './Menu.css';

function Menu() {
return (
<>
<div className="menu">
<button className="menu-button"><Link to="/"><span className="icon-[mdi-light--home] text-4xl"> <IoIosHome /></span></Link></button>
<button className="menu-button"><Link to="/about">About</Link></button>
</div>
<Routes>
<Route path="/" element={<Home/>}/>
<Route path="/about" element={<About/>}/>
</Routes>

</>
);
}

export default Menu;
32 changes: 32 additions & 0 deletions frontend/src/components/SwipeableCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.swipeable-card {
width: 300px;
height: 400px;
margin: 10px;
background-color: #f2f2f2;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.5em;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.6s ease;
transform-style: preserve-3d;
}

.swipeable-card.flipped {
transform: rotateY(180deg);
}

.swipeable-card:active {
transform: scale(0.95);
}

.swipeable-card-content {
backface-visibility: hidden;
}

.swipeable-card-back {
position: absolute;
transform: rotateY(180deg);
backface-visibility: hidden;
}
1 change: 1 addition & 0 deletions frontend/src/components/SwipeableCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { useSwipeable } from 'react-swipeable';
import './SwipeableCard.css'

interface SwipeableCardProps {
content: string;
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/components/TopMenu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* TopMenu.css */

.top-menu {
position: fixed;
top: 0;
width: 100%;
background-color: #333;
display: flex;
justify-content: space-around;
padding: 10px 0;
z-index: 1000; /* Ensures the menu stays on top */
}

.menu-button {
color: white;
background-color: transparent;
border: none;
font-size: 1em;
cursor: pointer;
}

.menu-button:hover {
color: #aaa;
}
15 changes: 15 additions & 0 deletions frontend/src/components/TopMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import './TopMenu.css';
import {IoIosSettings} from "react-icons/io";

function TopMenu() {
return (
<div className="top-menu">
<button className="menu-button">
<span className="icon-[mdi-light--home] text-2xl"> <IoIosSettings/></span>
</button>
</div>
);
}

export default TopMenu;
8 changes: 8 additions & 0 deletions frontend/src/pages/Home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.swipeable-cards-container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}


9 changes: 1 addition & 8 deletions frontend/src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React, {useState} from 'react';

// Import Swiper styles
import "swiper/css";
import "swiper/css/effect-coverflow";
import 'swiper/css/navigation';
import 'swiper/css/pagination';
import SwipeableCard from "../components/SwipeableCard.tsx";

// Initialize Swiper modules
// SwiperCore.use([Navigation, Pagination]);
import './Home.css'

function Home() {
const [cards] = useState([
Expand Down

0 comments on commit 2526a53

Please sign in to comment.