Skip to content

Commit

Permalink
Added flippable tiles (#68)
Browse files Browse the repository at this point in the history
* Added flippable tiles

* Centered tiles, added featured resources text

---------

Co-authored-by: “airman416” <“[email protected]”>
  • Loading branch information
airman416 and “airman416” authored Nov 9, 2023
1 parent 3ba7b0d commit 6ceb1fc
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@import url('https://fonts.googleapis.com/css2?family=Lora&display=swap');

.container {
font-family: "Lora", sans-serif;
font-size: 20px;
}

.icon-placeholder {
width: 60px;
height: 100px;
background: #fff; /* White background for the icon placeholder */
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
color: #555; /* Icon color (gray) */
}

.flip-card-outer {
width: 330px;
height: 253px;
margin: 25px 0;

&.focus-trigger:focus {
outline: 5px solid greenyellow;
outline-offset: 5px;
}

.flip-card-inner {
transform-style: preserve-3d;
transition: .5s linear .1s;
position: relative;
width: inherit;
height: inherit;

&.hover-trigger:hover {
transform: rotateY(180deg);
}

&.showBack {
transform: rotateY(180deg);
}

.card {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;

&.front {
transform: rotateY(0);
background-color: #f2f2f2;
color: #288BE4;
}

&.back {
transform: rotateY(180deg);
background-color: #f2f2f2;
color: #288BE4;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useState } from "react";
import './FlippableTile.scss';
import "bootstrap/dist/css/bootstrap.min.css";

export default function FlipCard({ ...props }) {
const card = props.card;

const [showBack, setShowBack] = useState(false);

function handleClick() {
setShowBack(!showBack);
}

return (
<div className="flip-card-outer" onClick={handleClick}>
<div className={`flip-card-inner ${showBack ? 'showBack' : ''}`}>
<div className="card front">
<div className="card-body d-flex justify-content-around align-items-center row">
<div className="icon-placeholder col-md-4"></div>
<p className="card-text text-center">{card.front}</p>
</div>
</div>
<div className="card back">
<div className="card-body d-flex justify-content-around align-items-center">
<p className="card-text text-center">{card.back}</p>
</div>
</div>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Header from './Header';
import MapLegend from '../../components/map/MapLegend';
import Navbar from '../Navbar';
import { SITE_STATUS_ROADMAP } from '../../constants';
import Tiles from './Tiles';

const icons: string[] = SITE_STATUS_ROADMAP.map((option) => option.image);

Expand Down Expand Up @@ -44,6 +45,9 @@ export default function MapPage() {
<About />
<Divider />
<div style={{ paddingTop: '15px'}} />
<div style={{ alignContent: 'center' }}>
<Tiles />
</div>
</div>
);
}
79 changes: 79 additions & 0 deletions apps/green-infrastructure/frontend/src/pages/mapPage/Tiles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import FlippableTile from './FlippableTile';

const cards = [
{
id: "0",
front: "Submit a Maintenance Report",
back: "Back"
},
{
id: "1",
front: "Click 1",
back: "Back"
},
{
id: "2",
front: "Adapt a GI Feature",
back: "Back"
},
{
id: "3",
front: "Click3",
back: "Back"
},
{
id: "4",
front: "Submit a Condition Assessment",
back: "Back"
},
{
id: "5",
front: "Click5",
back: "Back"
},
];

export default function App() {
return (
<div className="resources" style={{
display: 'flex',
padding: '20px 40px',
flexDirection: 'column',
alignItems: 'flex-start',
gap: '15px',
flexShrink: '0',
background: 'white',
}}>
<p style={{
color: 'var(--Text-Primary, #091F2F)',
fontFamily: 'Montserrat',
fontSize: '27px',
fontStyle: 'bold',
fontWeight: '1000',
lineHeight: 'normal',
textDecorationLine: 'underline',
margin: '0'
}}>
<u>FEATURES RESOURCES &#8594</u></p>
<div className="container">
<div className="row d-flex justify-content-center">
<div className="col-md-auto text-center">
{cards.slice(0, 2).map((card) => (
<FlippableTile key={card.id} card={card} />
))}
</div>
<div className="col-md-auto text-center">
{cards.slice(2, 4).map((card) => (
<FlippableTile key={card.id} card={card} />
))}
</div>
<div className="col-md-auto text-center">
{cards.slice(4, 6).map((card) => (
<FlippableTile key={card.id} card={card} />
))}
</div>
</div>
</div>
</div>
);
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@zodios/core": "^10.9.0",
"@zodios/express": "^10.6.1",
"antd": "^5.8.5",
"bootstrap": "^5.3.2",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"framer-motion": "^10.12.4",
Expand All @@ -44,6 +45,7 @@
"react-router-dom": "6.11.2",
"react-scripts": "^5.0.1",
"react-typical": "^0.1.3",
"sass": "^1.69.4",
"styled-components": "^6.0.5",
"tslib": "^2.3.0",
"typed.js": "^2.0.15",
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8460,6 +8460,11 @@ boolbase@^1.0.0, boolbase@~1.0.0:
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==

bootstrap@^5.3.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.3.2.tgz#97226583f27aae93b2b28ab23f4c114757ff16ae"
integrity sha512-D32nmNWiQHo94BKHLmOrdjlL05q1c8oxbtBphQFb9Z5to6eGRDCm0QgeaZ4zFBHzfg2++rqa2JkqCcxDy0sH0g==

bowser@^2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f"
Expand Down Expand Up @@ -16690,6 +16695,15 @@ sass@^1.42.1:
immutable "^4.0.0"
source-map-js ">=0.6.2 <2.0.0"

sass@^1.69.4:
version "1.69.4"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.69.4.tgz#10c735f55e3ea0b7742c6efa940bce30e07fbca2"
integrity sha512-+qEreVhqAy8o++aQfCJwp0sklr2xyEzkm9Pp/Igu9wNPoe7EZEQ8X/MBvvXggI2ql607cxKg/RKOwDj6pp2XDA==
dependencies:
chokidar ">=3.0.0 <4.0.0"
immutable "^4.0.0"
source-map-js ">=0.6.2 <2.0.0"

sax@^1.2.4, sax@~1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
Expand Down

0 comments on commit 6ceb1fc

Please sign in to comment.