Skip to content

Commit d8f6670

Browse files
committed
refactor(EntitySelection): update contributor display to include images and improve layout
1 parent 16c6c1e commit d8f6670

File tree

1 file changed

+29
-10
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/contributors

1 file changed

+29
-10
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/contributors/EntitySelection.tsx

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Image from 'next/image';
12
import { Button, Icon, Text } from 'opub-ui';
23

34
import { Icons } from '@/components/icons';
@@ -13,6 +14,7 @@ type EntitySectionProps = {
1314
selectedValues: Option[];
1415
onChange: (values: Option[]) => void;
1516
onRemove: (value: Option) => void;
17+
data: any;
1618
};
1719

1820
const EntitySection = ({
@@ -23,11 +25,12 @@ const EntitySection = ({
2325
selectedValues,
2426
onChange,
2527
onRemove,
28+
data,
2629
}: EntitySectionProps) => (
2730
<div>
2831
<Text variant="headingMd">{title}</Text>
2932
<div className="mt-5 flex flex-wrap items-start gap-5 lg:flex-nowrap">
30-
<div className="flex w-full flex-wrap items-end gap-5 lg:flex-nowrap">
33+
<div className="flex w-full flex-wrap items-start gap-5 lg:flex-nowrap">
3134
<div className="w-full lg:w-2/6">
3235
<Text>{label}</Text>
3336
<CustomCombobox
@@ -47,16 +50,32 @@ const EntitySection = ({
4750
</div>
4851
<div className="mt-3 flex flex-wrap gap-3 lg:mt-0">
4952
{selectedValues.map((item) => (
50-
<Button
51-
key={item.value}
52-
kind="tertiary"
53-
onClick={() => onRemove(item)}
54-
>
55-
<div className="flex items-center gap-2 rounded-2 p-2">
56-
<Text>{item.label}</Text>
57-
<Icon source={Icons.cross} size={18} />
53+
<div className="flex flex-col items-center gap-2" key={item.value}>
54+
<div className="rounded-4 bg-surfaceDefault p-4 shadow-basicMd">
55+
<Image
56+
src={
57+
data?.find((org: any) => org.id === item.value)?.logo?.url
58+
? `${process.env.NEXT_PUBLIC_BACKEND_URL}/${
59+
data?.find((org: any) => org.id === item.value)?.logo
60+
?.url
61+
}`
62+
: '/org.png'
63+
}
64+
alt={item.label}
65+
width={140}
66+
height={100}
67+
className="object-contain"
68+
/>
5869
</div>
59-
</Button>
70+
<Button kind="tertiary" onClick={() => onRemove(item)}>
71+
<div className="flex flex-col items-center gap-2 rounded-2 p-2 bg-greyExtralight">
72+
<div className="flex items-center gap-2">
73+
<Text>{item.label}</Text>
74+
<Icon source={Icons.cross} size={18} />
75+
</div>
76+
</div>
77+
</Button>
78+
</div>
6079
))}
6180
</div>
6281
</div>

0 commit comments

Comments
 (0)