From ae2c5fbba4125ae081cb5537bd30cfe232e790dd Mon Sep 17 00:00:00 2001 From: jakubmanczak Date: Thu, 22 Dec 2022 13:43:10 +0100 Subject: [PATCH] convert Icon component from enum input to string type --- components/Icon.tsx | 39 ++++++++++++++-------------- components/Navigation/Navigation.tsx | 4 +-- pages/index.tsx | 10 +++---- pages/o-gractwie.tsx | 6 ++--- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/components/Icon.tsx b/components/Icon.tsx index 6912cc8..10c8587 100644 --- a/components/Icon.tsx +++ b/components/Icon.tsx @@ -1,16 +1,15 @@ -enum IconSet { - Menu, - Users, - Link2, - ExternalLink, - Twitter, - GitHub, - YouTube, - Discord, -} +type iconselection = + | "Menu" + | "Users" + | "Link2" + | "ExternalLink" + | "Twitter" + | "GitHub" + | "YouTube" + | "Discord"; type iconprops = { - icon: IconSet; + icon: iconselection; width?: number; height?: number; } & React.SVGProps; @@ -21,7 +20,7 @@ const Icon = ({ icon, width, height, ...props }: iconprops) => { // - add {width || ogWidth} // - add {height || ogHeight} // - add {...props} - case IconSet.Menu: + case "Menu": return ( { ); - case IconSet.Users: + case "Users": return ( { ); - case IconSet.Link2: + case "Link2": return ( { ); - case IconSet.ExternalLink: + case "ExternalLink": return ( { ); - case IconSet.Twitter: + case "Twitter": // twitter icon courtesy of simpleicons.org return ( { ); - case IconSet.GitHub: + case "GitHub": // github icon courtesy of simpleicons.org return ( { ); - case IconSet.YouTube: + case "YouTube": // youtube icon courtesy of simpleicons.org return ( { ); - case IconSet.Discord: + case "Discord": // discord icon courtesy of simpleicons.org return ( { } }; -export { Icon, IconSet }; +export { Icon }; diff --git a/components/Navigation/Navigation.tsx b/components/Navigation/Navigation.tsx index 6d27b52..0aecdf4 100644 --- a/components/Navigation/Navigation.tsx +++ b/components/Navigation/Navigation.tsx @@ -1,6 +1,6 @@ import styles from "./Navigation.module.scss"; import { GractwoLogo } from "../Logo"; -import { Icon, IconSet } from "../Icon"; +import { Icon } from "../Icon"; import navigation from "../../data/navigation.json"; import Link from "next/link"; @@ -26,7 +26,7 @@ const Navigation = () => { ); })}
- + {/* TUTAJ WSTAWIĆ IKONKĘ PÓŹNIEJ */}
{navigation.map((navlink) => { diff --git a/pages/index.tsx b/pages/index.tsx index 58bb1e4..b7e7af3 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,7 +1,7 @@ import styles from "../styles/Index.module.scss"; import { useEffect, useState } from "react"; import { SEO } from "../components/SEO"; -import { Icon, IconSet } from "../components/Icon"; +import { Icon } from "../components/Icon"; import splashes from "../data/splashes.json"; import Link from "next/link"; import { IndexGallery } from "../components/IndexGallery/IndexGallery"; @@ -64,16 +64,16 @@ const PageIndex = () => {
- discord + discord - youtube + youtube - twitter + twitter - github + github
diff --git a/pages/o-gractwie.tsx b/pages/o-gractwie.tsx index 944d4a0..75dd424 100644 --- a/pages/o-gractwie.tsx +++ b/pages/o-gractwie.tsx @@ -2,7 +2,7 @@ import { GractwoLogo } from "../components/Logo"; import { SEO } from "../components/SEO"; import styles from "../styles/oGractwie.module.scss"; import Link from "next/link"; -import { Icon, IconSet } from "../components/Icon"; +import { Icon } from "../components/Icon"; import administracja from "../data/administracja.json"; import links from "../data/links.json"; @@ -36,11 +36,11 @@ const PageInfo = () => {
skład administracji - + linki i przekierowania - +