-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Component adding logic" (#3)
- Loading branch information
Showing
10 changed files
with
48 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.