Skip to content

Commit

Permalink
Merge pull request #11 from HectorSaldes/LIB-7-New-section-categories
Browse files Browse the repository at this point in the history
Lib 7 new section categories
  • Loading branch information
HectorSaldes committed Aug 1, 2023
2 parents 56b9283 + ab37373 commit 7dd5d54
Show file tree
Hide file tree
Showing 17 changed files with 513 additions and 203 deletions.
18 changes: 11 additions & 7 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ import Images from "./pages/Images";
// rome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
import Error from "./pages/Error";
import IconsById from "./pages/icons/IconsById";
import IconsByCategory from "./pages/icons/IconsByCategory";

export default function App() {
return (
<MainBrowser>
<Menu />
<Routes>
<Route path='/' element={<Home />} />
<Route path='/icons' element={<IconsByWord />} />
<Route path='/icons/by-id' element={<IconsById />} />
<Route path='/images' element={<Images />} />
<Route path='*' element={<Error />} />
</Routes>
<div className='p-4'>
<Routes>
<Route path='/' element={<Home />} />
<Route path='/icons' element={<IconsByWord />} />
<Route path='/icons/by-id' element={<IconsById />} />
<Route path='/icons/by-category' element={<IconsByCategory />} />
<Route path='/images' element={<Images />} />
<Route path='*' element={<Error />} />
</Routes>
</div>
</MainBrowser>
);
}
52 changes: 33 additions & 19 deletions src/components/ButtonUp.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
import { Button } from "primereact/button";
import React from "react";
import {Button} from "primereact/button";
import React, {useEffect, useState} from "react";

export default function ButtonUp({ goScrollUp }) {
return (
<div
className='speeddial-tooltip-demo'
style={{
position: "fixed",
bottom: "3em",
right: "3em",
}}
>
<Button
icon='pi pi-arrow-up'
className='p-button-rounded p-button-help p-button-lg speeddial-left'
onClick={() => goScrollUp()}
/>
</div>
);
export default function ButtonUp() {
const [scroll, setScroll] = useState(0);

useEffect(() => {
window.addEventListener("scroll", handleScroll, {passive: true});
return () => window.removeEventListener("scroll", handleScroll);
}, []);

const handleScroll = () => setScroll(window.pageYOffset);

const goScrollUp = () => {
window.scrollTo(0, 0);
document.querySelector("#inputSearch").focus();
};

return (
<div className='speeddial-tooltip-demo'
style={{
position: "fixed",
bottom: "3em",
right: "3em",
}}
>
{scroll > 200 && (<Button
icon='pi pi-arrow-up'
className='p-button-rounded p-button-help p-button-lg speeddial-left'
onClick={() => goScrollUp()}
/>)}

</div>
);
}
2 changes: 1 addition & 1 deletion src/components/EmptySearch.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Empty from "../assets/svg/emptyIcons.svg";

export default function EmptySearch({ title, color }) {
export default function EmptySearch({ title }) {
return (
<div className='col-12 text-center'>
<h1>Begin looking for some {title}</h1>
Expand Down
65 changes: 33 additions & 32 deletions src/components/IconCard.jsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
import React from "react";
import { Card } from "primereact/card";
import { Button } from "primereact/button";
import {Card} from "primereact/card";
import {Button} from "primereact/button";

export default function IconCard({ payload, getIconToDownload }) {
const { name, commonName, platform, id } = payload;
export default function IconCard({payload, getIconToDownload=function(){}, downloadble = true}) {
const {name, commonName, platform, id} = payload;

const header = () => (
<div className="col-12 flex justify-content-center pt-2">
<img
src={`https://img.icons8.com/${platform}/2x/${commonName}.png`}
alt="icon"
style={{ height: "100px", width: "100px" }}
/>
</div>
);
const header = () => (
<div className="col-12 flex justify-content-center pt-2">
<img
src={`https://img.icons8.com/${platform}/2x/${commonName}.png`}
alt="icon"
style={{height: "100px", width: "100px"}}
/>
</div>
);

return (
<div className="col-6 sm:col-4 md:col-2" key={id}>
<Card
className="iconCards"
style={{ backgroundColor: "var(--yellow-50)" }}
key={id}
subTitle={() => name.substring(0, 12)}
header={header}
footer={
<Button
label="SVG"
icon="pi pi-download"
className="col-12 p-button p-button-warning"
onClick={() => getIconToDownload(id, commonName)}
/>
}
/>
</div>
);
return (
<div className="col-6 sm:col-4 md:col-2" key={id}>
<Card
className="iconCards"
style={{backgroundColor: "var(--yellow-50)"}}
key={id}
subTitle={() => name.substring(0, 12)}
header={header}
footer={
downloadble && (<Button
label="Download"
icon="pi pi-download"
className="col-12 p-button p-button-warning"
onClick={() => getIconToDownload(id, commonName)}
/>)

}
/>
</div>
);
}
28 changes: 9 additions & 19 deletions src/components/Menu.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { useNavigate } from "react-router-dom";
import { Menubar } from "primereact/menubar";
import { Button } from "primereact/button";
import { useNavigate } from "react-router-dom";
import React from "react";

export default function Menu() {
const navigate = useNavigate();
Expand All @@ -25,6 +25,10 @@ export default function Menu() {
label: "Search by ID",
icon: "pi pi-fw pi-box",
command: () => navigate("/icons/by-id"),
},{
label: "Categories",
icon: "pi pi-fw pi-box",
command: () => navigate("/icons/by-category"),
},
],
},
Expand All @@ -38,24 +42,10 @@ export default function Menu() {
return (
<Menubar
model={items}
start={
<h1 className='mr-2 font-semibold' style={{ color: "black" }}>
LIBER
</h1>
}
start={<h1 className='mr-2 font-semibold' style={{ color: "black" }}>LIBER</h1>}
end={
<a
href='https://hectorsaldes.netlify.app/'
target='_blank'
rel='noreferrer'
style={{ textDecoration: "none" }}
>
<Button
text
raised
label='¡Give five! 👋🏼'
className='p-button-warning'
/>
<a href='https://hectorsaldes.netlify.app/' target='_blank' rel='noreferrer' style={{ textDecoration: "none" }}>
<Button text raised label='¡Give five! 👋🏼' className='p-button-warning'/>
</a>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Search({
options={dropdownCategories}
value={dropdownState}
emptyMessage='No options'
placeholder='Select a category'
placeholder='Select a platform'
onChange={(e) => dropdownSetState(e.value)}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SkeletonCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default function IconSkeleton() {
);
rows.push(data);
}
return <>{rows}</>;
return <div className='grid'>{rows}</div>;
}
2 changes: 1 addition & 1 deletion src/components/Title.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const Title = ({ title, description }) => (
<div className='my-3'>
<div className='my-3 text-center'>
<div className='font-bold mb-3' style={{ fontSize: "30px", color:'red' }}>
ATENTION: TO USE THIS APP YOU NEED TO ALLOW CORS API. {' '}
<a href="https://hectorsald.notion.site/How-to-allow-CORS-API-d53563af139e4992abebf40e04f06bbf" target='_blank' rel='noreferrer'>
Expand Down
26 changes: 12 additions & 14 deletions src/pages/Error.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,21 @@ import { Button } from "primereact/button";

export default function Error() {
return (
<div className='p-4 text-center'>
<div
className='font-semibold text-center'
style={{ fontSize: "7em", color: "var(--yellow-600)" }}
>
<>
<div className='font-semibold text-center' style={{ fontSize: "7em", color: "var(--yellow-600)" }}>
404
</div>
<div className='mb-5' style={{ fontSize: "2em" }}>
<div className='mb-5 text-center' style={{ fontSize: "2em" }}>
That page could not be found
<br/>
<Link to='/' style={{ textDecoration: "none" }}>
<Button
label='Go back to home'
icon='pi pi-home'
className='p-button p-button-outlined p-button-secondary'
/>
</Link>
</div>
<Link to='/' style={{ textDecoration: "none" }}>
<Button
label='Go back to home'
icon='pi pi-home'
className='p-button p-button-outlined p-button-secondary'
/>
</Link>
</div>
</>
);
}
108 changes: 48 additions & 60 deletions src/pages/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,66 +1,54 @@
import { Card } from "primereact/card";
import {Card} from "primereact/card";
import React from "react";
import { myCards } from "../assets/utils/Items";
import {myCards} from "../assets/utils/Items";
import "../assets/css/cardStyle.css";

export default function Home() {
const CardHome = ({ c }) => (
<div className='col-12 sm:col-4' data-aos="fade-up">
<Card
style={{ background: "var(--yellow-100)" }}
className='mb-2 homeCards'
title={c.title}
header={
<img
style={{ objectFit: "cover" }}
width='100%'
height='200px'
alt={c.title}
src={c.image}
/>
}
>
<div className='text-justify' style={{ lineHeight: "1.5", fontSize: "20px", height: "200px" }}>
{c.text}
</div>
</Card>
</div>
);
const CardHome = ({c}) => (
<div className='col-12 sm:col-4' data-aos="fade-up">
<Card
style={{background: "var(--yellow-100)"}}
className='mb-2 homeCards'
title={c.title}
header={
<img
style={{objectFit: "cover"}}
width='100%'
height='200px'
alt={c.title}
src={c.image}
/>
}
>
<div className='text-justify' style={{lineHeight: "1.5", fontSize: "20px", height: "200px"}}>
{c.text}
</div>
</Card>
</div>
);

return (
<div className='p-4'>
<div
className='font-semibold text-center title'
style={{ fontSize: "8em" }}
>
LIBER
</div>
<div className='text-justify md:text-center'>
<div
className='p-text-italic p-text-center'
style={{ fontSize: "1.5em", color: "var(--yellow-500)" }}
>
LIBER from Roman means free
</div>
<div
style={{ fontSize: "1.5em", marginBottom: "150px" }}
className='my-5'
>
This is a proyect created to help others to download and upload
resources completely free from{" "}
<a
style={{ color: "green", fontWeight: "bold" }}
href="https://icons8.com/"
target='_blank'
rel='noreferrer'
>
Icons8
</a>
</div>
</div>
<div className='grid text-center'>
{myCards.map((c, index) => ( <CardHome key={(index+1)} c={c} />))}
</div>
</div>
);
return (
<>
<div className='font-semibold text-center title' style={{fontSize: "8em"}}>
LIBER
</div>
<div className='text-justify md:text-center'>
<div className='p-text-italic p-text-center'
style={{fontSize: "1.5em", color: "var(--yellow-500)"}}>
LIBER from Roman means free
</div>
<div style={{fontSize: "1.5em", marginBottom: "150px"}} className='my-5'>
This is a proyect created to help others to download and upload
resources completely free from{" "}
<a style={{color: "green", fontWeight: "bold"}} href="https://icons8.com/" target='_blank'
rel='noreferrer'>
Icons8
</a>
</div>
</div>
<div className='grid text-center'>
{myCards.map((c, index) => (<CardHome key={(index + 1)} c={c}/>))}
</div>
</>
);
}
Loading

0 comments on commit 7dd5d54

Please sign in to comment.