File tree 4 files changed +77
-76
lines changed
src/Components/AddSocialPlatform 4 files changed +77
-76
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @programmer_network/yail" ,
3
- "version" : " 1.0.188 " ,
3
+ "version" : " 1.0.189 " ,
4
4
"description" : " Programmer Network's official UI library for React" ,
5
5
"author" : " Aleksandar Grbic - (https://programmer.network)" ,
6
6
"publishConfig" : {
Original file line number Diff line number Diff line change @@ -8,71 +8,76 @@ export default {
8
8
component : AddSocialPlatform
9
9
} ;
10
10
11
- export const Default = ( ) => {
12
- const SOCIAL_PLATFORMS = [
13
- {
14
- name : "Github" ,
15
- url : "github.com/"
16
- } ,
17
- {
18
- name : "Gitlab" ,
19
- url : "gitlab.com/"
20
- } ,
21
- {
22
- name : "Stackoverflow" ,
23
- url : "stackoverflow.com/users/"
24
- } ,
25
- {
26
- name : "Linkedin" ,
27
- url : "linkedin.com/in/"
28
- } ,
29
- {
30
- name : "YouTube" ,
31
- url : "youtube.com/"
32
- } ,
33
- {
34
- name : "Twitter" ,
35
- url : "twitter.com/"
36
- } ,
37
- {
38
- name : "Mastodon" ,
39
- url : "mastodon.social/"
40
- } ,
41
- {
42
- name : "Codewars" ,
43
- url : "codewars.com/users/"
44
- } ,
45
- {
46
- name : "Patreon" ,
47
- url : "patreon.com/user?u="
48
- } ,
49
- {
50
- name : "Hackernews" ,
51
- url : "news.ycombinator.com/user?id="
52
- } ,
53
- {
54
- name : "Reddit" ,
55
- url : "reddit.com/user/"
56
- } ,
57
- {
58
- name : "Hackerrank" ,
59
- url : "hackerrank.com/"
60
- } ,
61
- {
62
- name : "Leetcode" ,
63
- url : "leetcode.com/"
64
- } ,
65
- {
66
- name : "Exercism" ,
67
- url : "exercism.org/profiles/"
68
- }
69
- ] ;
11
+ const SOCIAL_PLATFORMS = [
12
+ {
13
+ name : "Github" ,
14
+ url : "github.com/"
15
+ } ,
16
+ {
17
+ name : "Gitlab" ,
18
+ url : "gitlab.com/"
19
+ } ,
20
+ {
21
+ name : "Stackoverflow" ,
22
+ url : "stackoverflow.com/users/"
23
+ } ,
24
+ {
25
+ name : "Linkedin" ,
26
+ url : "linkedin.com/in/"
27
+ } ,
28
+ {
29
+ name : "YouTube" ,
30
+ url : "youtube.com/"
31
+ } ,
32
+ {
33
+ name : "Twitter" ,
34
+ url : "twitter.com/"
35
+ } ,
36
+ {
37
+ name : "Mastodon" ,
38
+ url : "mastodon.social/"
39
+ } ,
40
+ {
41
+ name : "Codewars" ,
42
+ url : "codewars.com/users/"
43
+ } ,
44
+ {
45
+ name : "Patreon" ,
46
+ url : "patreon.com/user?u="
47
+ } ,
48
+ {
49
+ name : "Hackernews" ,
50
+ url : "news.ycombinator.com/user?id="
51
+ } ,
52
+ {
53
+ name : "Reddit" ,
54
+ url : "reddit.com/user/"
55
+ } ,
56
+ {
57
+ name : "Hackerrank" ,
58
+ url : "hackerrank.com/"
59
+ } ,
60
+ {
61
+ name : "Leetcode" ,
62
+ url : "leetcode.com/"
63
+ } ,
64
+ {
65
+ name : "Exercism" ,
66
+ url : "exercism.org/profiles/"
67
+ }
68
+ ] ;
70
69
70
+ export const Default = ( ) => {
71
71
return (
72
72
< div >
73
73
< AddSocialPlatform
74
74
platforms = { SOCIAL_PLATFORMS }
75
75
onAdd = { data => console . log ( data ) }
76
+ valueProps = { {
77
+ name : "cool" ,
78
+ label : "Story" ,
79
+ hint : "Username, a slug or a handle. Different platforms call it differently. Do not include the base URL."
80
+ } }
76
81
/>
77
82
</ div >
78
83
) ;
Original file line number Diff line number Diff line change @@ -3,13 +3,17 @@ import { FC } from "react";
3
3
4
4
import Button from "Components/Button" ;
5
5
import { Input , Select } from "Components/Inputs" ;
6
- import { Paragraph } from "Components/Typography" ;
7
6
8
7
import { IAddSocialPlatformProps } from "./types" ;
9
8
10
9
const AddSocialPlatform : FC < IAddSocialPlatformProps > = ( {
11
10
onAdd,
12
- platforms
11
+ platforms,
12
+ valueProps = {
13
+ name : "" ,
14
+ label : "" ,
15
+ hint : ""
16
+ }
13
17
} ) => {
14
18
const form = useAJVForm (
15
19
{
@@ -50,20 +54,7 @@ const AddSocialPlatform: FC<IAddSocialPlatformProps> = ({
50
54
/>
51
55
< div className = 'yl-col-span-5' >
52
56
< Input
53
- name = 'url'
54
- label = 'Username'
55
- hint = {
56
- < div >
57
- < Paragraph >
58
- Username, a slug or a handle. Different platforms call it
59
- differently.
60
- </ Paragraph >
61
- < Paragraph className = 'yl-text-red-500' >
62
- < span className = 'yl-font-bold' > Do not</ span > include the base
63
- URL.
64
- </ Paragraph >
65
- </ div >
66
- }
57
+ { ...valueProps }
67
58
value = { form . state . url . value }
68
59
error = { form . state . url . error }
69
60
onChange = { form . set }
Original file line number Diff line number Diff line change 1
1
export interface IAddSocialPlatformProps {
2
2
platforms : { name : string ; url : string } [ ] ;
3
3
onAdd : ( data : Record < string , string > ) => void ;
4
+ valueProps ?: {
5
+ name : string ;
6
+ label : string ;
7
+ hint ?: string ;
8
+ } ;
4
9
}
You can’t perform that action at this time.
0 commit comments