|
1 | 1 | import { FC, useEffect, useState } from "react"; |
2 | 2 | import { Badge } from "../../types/line"; |
3 | 3 | import GreenButton from "../buttons/GreenButton"; |
4 | | -import Input from "../input/Input"; |
5 | | -import SingleCodeblock from "../text/SingleCodeblock"; |
6 | 4 | import { FiSave } from "react-icons/fi"; |
7 | 5 | import SecondaryButton from "../buttons/SecondaryButton"; |
| 6 | +import Input from "../input/Input"; |
8 | 7 |
|
9 | 8 | interface LinePopupProps { |
10 | 9 | isActive: boolean; |
@@ -77,75 +76,48 @@ const LinePopup: FC<LinePopupProps> = (props) => { |
77 | 76 | Line #{props.lineNumber}: Add badge |
78 | 77 | </div> |
79 | 78 |
|
80 | | - <div className="flex flex-col gap-3 my-3"> |
81 | | - <div> |
82 | | - <Input |
83 | | - label="Icon" |
84 | | - placeholder="react" |
85 | | - setValue={setIcon} |
86 | | - value={icon} |
87 | | - /> |
88 | | - <div className="italic text-gh-text-secondary text-sm mx-4"> |
89 | | - -- You can browse between the icons{" "} |
90 | | - <a |
91 | | - href="https://simpleicons.org/" |
92 | | - target="_blank" |
93 | | - rel="noreferrer" |
94 | | - className="text-gh-blue hover:underline" |
95 | | - tabIndex={4} |
96 | | - > |
97 | | - here |
98 | | - </a> |
99 | | - . |
100 | | - </div> |
101 | | - </div> |
| 79 | + <div className="flex flex-col gap-3 my-3 px-6"> |
| 80 | + <Input |
| 81 | + label="Icon" |
| 82 | + placeholder="react" |
| 83 | + value={icon} |
| 84 | + setValue={(val: string) => setIcon(val)} |
| 85 | + validate={() => ""} |
| 86 | + helperText="You can browse between the icons here: https://simpleicons.org/" |
| 87 | + /> |
102 | 88 |
|
103 | 89 | <div className="w-[95%] h-[.8px] bg-gh-border mx-auto" /> |
104 | 90 |
|
105 | 91 | <Input |
106 | 92 | label="Badge label" |
107 | 93 | placeholder="react" |
108 | | - setValue={setLabel} |
109 | 94 | value={label} |
| 95 | + setValue={(val: string) => setLabel(val)} |
| 96 | + validate={() => ""} |
110 | 97 | /> |
111 | 98 |
|
112 | 99 | <div className="w-[95%] h-[.8px] bg-gh-border mx-auto" /> |
113 | 100 |
|
114 | | - <div> |
115 | | - <Input |
116 | | - label="Badge color" |
117 | | - placeholder="#3498db" |
118 | | - setValue={setColor} |
119 | | - value={color} |
120 | | - /> |
121 | | - <div className="italic text-gh-text-secondary text-sm mx-4"> |
122 | | - -- The badge color is either a hexadecimal color code or the value{" "} |
123 | | - <SingleCodeblock code="auto" />. |
124 | | - </div> |
125 | | - </div> |
126 | | - |
127 | | - <div className="w-[95%] h-[.8px] bg-gh-border mx-auto" /> |
128 | | - |
129 | | - {errorMsg !== undefined ? ( |
130 | | - <div className="text-red-400 text-sm italic mx-4">-- {errorMsg}</div> |
131 | | - ) : ( |
132 | | - <div className="text-green-500 text-sm italic mx-4"> |
133 | | - -- Looks good! |
134 | | - </div> |
135 | | - )} |
136 | | - |
137 | | - <div className="w-[95%] h-[.8px] bg-gh-border mx-auto" /> |
138 | | - |
139 | | - <div className="flex items-stretch"> |
140 | | - <GreenButton |
141 | | - icon={FiSave} |
142 | | - onClick={handleSave} |
143 | | - text="Save" |
144 | | - disabled={errorMsg !== undefined} |
145 | | - /> |
| 101 | + <Input |
| 102 | + label="Badge color" |
| 103 | + placeholder="#3498db" |
| 104 | + value={color} |
| 105 | + setValue={(val: string) => setColor(val)} |
| 106 | + validate={() => ""} |
| 107 | + helperText="The badge color is either a hexadecimal color code or the value auto." |
| 108 | + /> |
| 109 | + </div> |
| 110 | + <div className="w-[95%] h-[.8px] bg-gh-border mx-auto" /> |
| 111 | + |
| 112 | + <div className="flex items-stretch py-4"> |
| 113 | + <GreenButton |
| 114 | + icon={FiSave} |
| 115 | + onClick={handleSave} |
| 116 | + text="Save" |
| 117 | + disabled={errorMsg !== undefined} |
| 118 | + /> |
146 | 119 |
|
147 | | - <SecondaryButton onClick={handleCancel} text="Cancel" /> |
148 | | - </div> |
| 120 | + <SecondaryButton onClick={handleCancel} text="Cancel" /> |
149 | 121 | </div> |
150 | 122 | </div> |
151 | 123 | ); |
|
0 commit comments