Skip to content

Commit 6513516

Browse files
committed
tags styling
1 parent ad7f7d9 commit 6513516

File tree

1 file changed

+55
-17
lines changed

1 file changed

+55
-17
lines changed

apps/frontend/src/components/launches/tags.component.tsx

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -170,33 +170,70 @@ export const TagsComponent: FC<{
170170
selected={tagValue}
171171
onAdd={onAddition}
172172
onInput={setSuggestions}
173+
renderOption={(option) => {
174+
const findTag = data?.tags?.find(
175+
(f) => f.name === option.option.label
176+
);
177+
return (
178+
<div
179+
className="flex flex-row items-center gap-2 p-2 cursor-pointer hover:bg-customColor1 "
180+
{...option}
181+
>
182+
<input
183+
type="checkbox"
184+
checked={
185+
tagValue.findIndex((f) => f.label === option.option.label) >
186+
-1
187+
}
188+
readOnly
189+
/>
190+
<div
191+
className="size-3 rounded-full flex-shrink-0"
192+
style={{
193+
backgroundColor: findTag?.color || '#942828',
194+
}}
195+
/>
196+
{option.option.label}
197+
{/* edit and delete butotns */}
198+
<div className="flex items-center flex-grow flex-row-reverse">
199+
{findTag && (
200+
<Button
201+
onClick={edit(findTag)}
202+
className="!h-6 !px-2 !rounded !text-xs !bg-third items-center hover:!opacity-70"
203+
>
204+
<svg
205+
xmlns="http://www.w3.org/2000/svg"
206+
fill="none"
207+
viewBox="0 0 24 24"
208+
strokeWidth={1.5}
209+
stroke="currentColor"
210+
className="w-3 h-3"
211+
>
212+
<path
213+
strokeLinecap="round"
214+
strokeLinejoin="round"
215+
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"
216+
/>
217+
</svg>
218+
{t('edit', 'Edit')}
219+
</Button>
220+
)}
221+
</div>
222+
</div>
223+
);
224+
}}
173225
onDelete={onDelete}
174226
renderTag={(tag) => {
175227
const findTag = data?.tags?.find((f) => f.name === tag.tag.label);
176-
const findIndex = tagValue.findIndex(
177-
(f) => f.label === tag.tag.label
178-
);
179228
return (
180229
<div
181-
className={`min-w-[50px] float-left ms-[4px] p-[3px] rounded-sm relative`}
230+
className={`min-w-[50px] float-left ms-[4px] p-[3px] rounded-lg relative cursor-pointer text-[12px] flex items-center justify-center tag-item`}
182231
style={{
183232
backgroundColor: findTag?.color,
184233
}}
185234
>
186-
<div
187-
className="absolute -top-[5px] start-[10px] text-[12px] text-red-600 bg-white px-[3px] rounded-full"
188-
onClick={edit(findTag)}
189-
>
190-
{t('edit', 'Edit')}
191-
</div>
192-
<div
193-
className="absolute -top-[5px] -start-[5px] text-[12px] text-red-600 bg-white px-[3px] rounded-full"
194-
onClick={() => onDelete(findIndex)}
195-
>
196-
X
197-
</div>
198235
<div className="text-white mix-blend-difference">
199-
{tag.tag.label}
236+
{findTag.name}
200237
</div>
201238
</div>
202239
);
@@ -206,6 +243,7 @@ export const TagsComponent: FC<{
206243
</>
207244
);
208245
};
246+
209247
const ShowModal: FC<{
210248
tag: string;
211249
color?: string;

0 commit comments

Comments
 (0)