From 6fa69bcecacd225134a90efc4448ebd3de7138da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Schr=C3=B6tler?= Date: Sun, 4 Apr 2021 18:02:52 +0200 Subject: [PATCH] Finalised first SocialBadge revision --- .../SocialBadge/SocialBadge.stories.tsx | 14 ++++++---- src/components/SocialBadge/index.tsx | 27 ++++++++++++------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/components/SocialBadge/SocialBadge.stories.tsx b/src/components/SocialBadge/SocialBadge.stories.tsx index a4adc5a..55b718b 100644 --- a/src/components/SocialBadge/SocialBadge.stories.tsx +++ b/src/components/SocialBadge/SocialBadge.stories.tsx @@ -6,7 +6,9 @@ export default { title: "Component/SocialBadge", component: SocialBadge, argTypes: { - title: { control: "string" } + title: { description: "The text displayed to the right of the icon" }, + link: { description: "The link that is opened when the Badge is clicked" }, + imagePath: { description: "The path to the circular image on the left" }, } } as Meta @@ -16,8 +18,10 @@ const Template: Story = (args) => export const Default = Template.bind({}) Default.args = {} -// Title = "Hello World" -export const TitleHelloWorld = Template.bind({}) -TitleHelloWorld.args = { - title: "Hello World" +// GitHub Variant +export const Github = Template.bind({}) +Github.args = { + title: "github.com", + link: "https://github.com/networkException", + imagePath: "/assets/icons/github.svg" } diff --git a/src/components/SocialBadge/index.tsx b/src/components/SocialBadge/index.tsx index e1962a5..79f05ba 100644 --- a/src/components/SocialBadge/index.tsx +++ b/src/components/SocialBadge/index.tsx @@ -1,15 +1,22 @@ -import React from "react" -import Logo from "../../assets/square-logo.svg" +import React from "react"; export interface SocialBadgeProps { - title?: string + title: string + link: string, + imagePath: string } -export const SocialBadge: React.FC = () => { - return ( - - -
GitHub
-
- ) +export const SocialBadge: React.FC = ({title, link, imagePath}) => { + link = link ?? "/404"; + title = title ?? "Unbekannt"; + + console.log(imagePath); + + return ( + + {imagePath?():null} +
{title}
+
+ ) }