diff --git a/package.json b/package.json index 0798bcf..f2b2834 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@programmer_network/yail", - "version": "1.0.188", + "version": "1.0.189", "description": "Programmer Network's official UI library for React", "author": "Aleksandar Grbic - (https://programmer.network)", "publishConfig": { diff --git a/src/Components/AddSocialPlatform/AddSocialPlatform.stories.tsx b/src/Components/AddSocialPlatform/AddSocialPlatform.stories.tsx index 696e50d..7491fca 100644 --- a/src/Components/AddSocialPlatform/AddSocialPlatform.stories.tsx +++ b/src/Components/AddSocialPlatform/AddSocialPlatform.stories.tsx @@ -8,71 +8,76 @@ export default { component: AddSocialPlatform }; -export const Default = () => { - const SOCIAL_PLATFORMS = [ - { - name: "Github", - url: "github.com/" - }, - { - name: "Gitlab", - url: "gitlab.com/" - }, - { - name: "Stackoverflow", - url: "stackoverflow.com/users/" - }, - { - name: "Linkedin", - url: "linkedin.com/in/" - }, - { - name: "YouTube", - url: "youtube.com/" - }, - { - name: "Twitter", - url: "twitter.com/" - }, - { - name: "Mastodon", - url: "mastodon.social/" - }, - { - name: "Codewars", - url: "codewars.com/users/" - }, - { - name: "Patreon", - url: "patreon.com/user?u=" - }, - { - name: "Hackernews", - url: "news.ycombinator.com/user?id=" - }, - { - name: "Reddit", - url: "reddit.com/user/" - }, - { - name: "Hackerrank", - url: "hackerrank.com/" - }, - { - name: "Leetcode", - url: "leetcode.com/" - }, - { - name: "Exercism", - url: "exercism.org/profiles/" - } - ]; +const SOCIAL_PLATFORMS = [ + { + name: "Github", + url: "github.com/" + }, + { + name: "Gitlab", + url: "gitlab.com/" + }, + { + name: "Stackoverflow", + url: "stackoverflow.com/users/" + }, + { + name: "Linkedin", + url: "linkedin.com/in/" + }, + { + name: "YouTube", + url: "youtube.com/" + }, + { + name: "Twitter", + url: "twitter.com/" + }, + { + name: "Mastodon", + url: "mastodon.social/" + }, + { + name: "Codewars", + url: "codewars.com/users/" + }, + { + name: "Patreon", + url: "patreon.com/user?u=" + }, + { + name: "Hackernews", + url: "news.ycombinator.com/user?id=" + }, + { + name: "Reddit", + url: "reddit.com/user/" + }, + { + name: "Hackerrank", + url: "hackerrank.com/" + }, + { + name: "Leetcode", + url: "leetcode.com/" + }, + { + name: "Exercism", + url: "exercism.org/profiles/" + } +]; +export const Default = () => { return (
console.log(data)} + valueProps={{ + name: "cool", + label: "Story", + hint: "Username, a slug or a handle. Different platforms call it differently. Do not include the base URL." + }} />
); diff --git a/src/Components/AddSocialPlatform/index.tsx b/src/Components/AddSocialPlatform/index.tsx index c00ce6c..8b788f4 100644 --- a/src/Components/AddSocialPlatform/index.tsx +++ b/src/Components/AddSocialPlatform/index.tsx @@ -3,13 +3,17 @@ import { FC } from "react"; import Button from "Components/Button"; import { Input, Select } from "Components/Inputs"; -import { Paragraph } from "Components/Typography"; import { IAddSocialPlatformProps } from "./types"; const AddSocialPlatform: FC = ({ onAdd, - platforms + platforms, + valueProps = { + name: "", + label: "", + hint: "" + } }) => { const form = useAJVForm( { @@ -50,20 +54,7 @@ const AddSocialPlatform: FC = ({ />
- - Username, a slug or a handle. Different platforms call it - differently. - - - Do not include the base - URL. - -
- } + {...valueProps} value={form.state.url.value} error={form.state.url.error} onChange={form.set} diff --git a/src/Components/AddSocialPlatform/types.ts b/src/Components/AddSocialPlatform/types.ts index 1b54e84..9e6ad6e 100644 --- a/src/Components/AddSocialPlatform/types.ts +++ b/src/Components/AddSocialPlatform/types.ts @@ -1,4 +1,9 @@ export interface IAddSocialPlatformProps { platforms: { name: string; url: string }[]; onAdd: (data: Record) => void; + valueProps?: { + name: string; + label: string; + hint?: string; + }; }