Skip to content

Commit

Permalink
Revert "Component adding logic" (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabDonRixos authored Oct 26, 2024
2 parents c9a5c9c + c23c409 commit c784c80
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 368 deletions.
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/COMPONENT-REQUEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ body:
- "Icons"
- "Animations"
- "Illustrations"
- "Simple"
- "Complex"
- "3D"
- "Text Art"
- "Scenes"
Expand All @@ -33,6 +31,7 @@ body:
- "Holidays"
- "Seasonal"
- "Graphics"
- "IDEs"
- "Games"
- "Film / Series / Videos"
- "Pixel Art"
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/Component-IN-PROGRESS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ body:
- "Icons"
- "Animations"
- "Illustrations"
- "Simple"
- "Complex"
- "3D"
- "Text Art"
- "Scenes"
Expand All @@ -33,6 +31,7 @@ body:
- "Holidays"
- "Seasonal"
- "Graphics"
- "IDEs"
- "Games"
- "Film / Series / Videos"
- "Pixel Art"
Expand Down
File renamed without changes.
File renamed without changes
83 changes: 9 additions & 74 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,81 +1,16 @@
import Header from "./components/header/Header.tsx";
import {CSSProperties, useState} from "react";
import {EArtworkTags} from "./artworks/0_artworks-list/artworkTags.ts";
import artworksList from "./artworks/0_artworks-list/artworksList.tsx";
import Template from "./artworks/1_Template/Template.tsx";

function App() {
const [currentTag, setCurrentTag] = useState<EArtworkTags>();
const [search, setSearch] = useState("");

const filteredArtworks = artworksList
.filter(artwork => currentTag ? artwork.tags?.includes(currentTag) : true)
.filter(artwork => search
? (
artwork.tags?.some(tag => tag.toLowerCase().includes(search.toLowerCase())) ||
artwork.titel.toLowerCase().includes(search.toLowerCase()) ||
artwork.description.toLowerCase().includes(search.toLowerCase()) ||
artwork.gitHubName.toLowerCase().includes(search.toLowerCase()) ||
artwork.editedAt?.toLocaleDateString().toLowerCase().includes(search.toLowerCase())
)
: true
);

return (
<>
<Header
setCurrentTag={setCurrentTag}
setSearch={setSearch}
currentTag={currentTag}
search={search}
/>
<div className={"container"}>
<div className={"component-list"}>
{filteredArtworks.length > 0 ?
filteredArtworks.map(artwork =>
<div
key={artworksList.indexOf(artwork)}
className={`component${artwork.full ? " full" : ""}`}
style={
artwork.backgroundColor && artwork.backgroundColor.length <= 7
? {"--background-color": artwork.backgroundColor} as CSSProperties
: {"--background-color": "#000000"} as CSSProperties
}
>
<div className={"content"}>
{artwork.component}
</div>
<div className={"contribution"}>
<div className={"component-creator"}>
<a href={`https://github.com/${artwork.gitHubName}/`} target={"_blank"}>
<span>© {artwork.gitHubName}</span>
</a>

{artwork.oneLink &&
<a href={artwork.oneLink.href} target={"_blank"}>
{artwork.oneLink.name}
</a>
}
</div>
<h1>{artwork.titel}</h1>
{artwork.editedAt && <span>{artwork.editedAt.toLocaleDateString()}</span>}
</div>
</div>
) : (
<div className={"no-components-found"}>
<span>No Components where found corresponding to the current filter settings.</span>
<button onClick={() => {
setCurrentTag(undefined);
setSearch("");
}}>
Reset Filters
</button>
</div>
)
}
</div>
</div>
</>
)
return (
<>
<Header/>
<div className={"container"}>
<Template />
</div>
</>
)
}

export default App
25 changes: 0 additions & 25 deletions src/artworks/0_artworks-list/artworkTags.ts

This file was deleted.

31 changes: 5 additions & 26 deletions src/artworks/0_artworks-list/artworksList.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,18 @@
import {ReactNode} from "react";
import Template from "../1_Template/Template.tsx"
import {EArtworkTags} from "./artworkTags.ts";

export interface ILink {
name: string;
href: string;
}

export interface IArtworkItem {
component: ReactNode;
titel: string;
description: string;
gitHubName: string;
tags?: EArtworkTags[] | string[]
backgroundColor?: `#${string}`; // No transparent backgrounds
full?: boolean; // Only use this if you really have no other but to claim more space.
oneLink?: ILink;
editedAt?: Date;
githubName: string;
oneLink?: string;
}

const artworksList: IArtworkItem[] = [
{
component: <Template />,
titel: "circle",
description: "round circle",
gitHubName: "FabDonRixos",
tags: [EArtworkTags.SIMPLE],
backgroundColor: "#000",
full: true,
oneLink: {
name: "fabian.li",
href: "https://fabian.li"
},
editedAt: new Date("2024-10-26")
},
githubName: "FabDonRixos",
oneLink: "https://fabian.li"
}
]

export default artworksList;
76 changes: 21 additions & 55 deletions src/components/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,33 @@
import {IconLogo, IconFabian, IconGithub, IconLinkedin} from "../../assets/iconLibrary.ts";
import style from "./header.module.scss";
import {EArtworkTags} from "../../artworks/0_artworks-list/artworkTags.ts";

interface InputsProps {
setCurrentTag: (currentTag: EArtworkTags) => void;
setSearch: (search: string) => void;
currentTag?: EArtworkTags;
search: string;
}

export default function Header(props: InputsProps) {
export default function Header() {

return (
<header className={style.header}>
<div className={style.top} >
<div className={style.left}>
<IconLogo className={style.logo}/>
<h1>Awesome Arts</h1>
<div className={style.left}>
<IconLogo className={style.logo}/>
<h1>Awesome Arts</h1>
</div>
<div className={style.right}>
<div className={style.search}>

</div>
<div className={style.right}>
<Inputs {...props} />
<div className={style.links}>
<a href="https://github.com/FabDonRixos/awesome-arts" target={"_blank"}>
<IconGithub/>
</a>
<a href="https://www.linkedin.com/in/fabian-mathys-42a595332/" target={"_blank"}>
<IconLinkedin/>
</a>
<a href="https://fabian.li" target={"_blank"}>
<IconFabian/>
</a>
</div>
<div className={style.filters}>

</div>
<div className={style.links}>
<a href="https://github.com/FabDonRixos/awesome-arts" target={"_blank"}>
<IconGithub/>
</a>
<a href="https://www.linkedin.com/in/fabian-mathys-42a595332/" target={"_blank"}>
<IconLinkedin/>
</a>
<a href="https://fabian.li" target={"_blank"}>
<IconFabian/>
</a>
</div>
</div>
<div className={style.bottom} >
<Inputs {...props} />
</div>
</header>
);
}

function Inputs({setCurrentTag, setSearch, currentTag, search}: InputsProps) {
return (
<>
<input
className={style.search}
type="text"
placeholder={"Search"}
value={search}
onChange={e => setSearch(e.target.value)}/>

<select
className={style.filters}
name={"tagSelection"}
defaultValue={""}
value={currentTag}
onChange={e => setCurrentTag(e.target.value as EArtworkTags)}
>
<option value={""}>Select a Tag</option>
{Object.entries(EArtworkTags).map(([key, value]) =>
<option key={key} label={key} value={value}/>
)}
</select>
</>
)
}
50 changes: 11 additions & 39 deletions src/components/header/header.module.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
.header {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
background-color: #121212;
border-bottom: 1px solid #444444;
padding: 1rem 2rem;
}

.top {
display: flex;
justify-content: space-between;
align-items: center;

svg {
width: inherit;
height: inherit;
}

& .left {
& .left{
display: flex;
align-items: center;
gap: 1rem;
Expand All @@ -25,23 +20,23 @@
width: 5rem;
height: 5rem;
}

@media (max-width: 403px) {
@media (max-width: 768px) {
& h1 {
display: none;
}
}
}

& .right {
display: flex;
gap: 2rem;
margin-left: 1rem;

@media (max-width: 991px) {
& .search, & .filters {
display: none;
}
.filters {

}

.search {

}

.links {
Expand All @@ -57,35 +52,12 @@
&:is(:hover, :active, :focus) {
color: white;
outline: none;
filter: drop-shadow(3px 5px 5px #03dc00);
}

&:last-child {
height: 2.5rem;
}

@media (max-width: 767px) {
&:not(:first-child) {
display: none;
}
}
}
}
}
}

.bottom {
display: flex;
justify-content: end;
flex-wrap: wrap;
gap: 1rem;
margin-top: 1rem;

@media (min-width: 992px) {
display: none;
}
}

.search, .filters {
width: 10rem;
}
Loading

0 comments on commit c784c80

Please sign in to comment.