Skip to content

Commit caacc5e

Browse files
authored
Merge pull request #92 from CivicDataLab/91-fix-accordion-placement
Fix accordion placements
2 parents 89ad01c + 3e3a18e commit caacc5e

2 files changed

Lines changed: 61 additions & 57 deletions

File tree

  • app/[locale]/(user)/datasets/[datasetIdentifier]/components

app/[locale]/(user)/datasets/[datasetIdentifier]/components/AccessModels/index.tsx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,31 +151,32 @@ const AccessModels = () => {
151151
</div>
152152
<div className="align-center flex flex-col justify-between gap-4 sm:flex-row lg:items-center">
153153
<CustomTags type={item.type.split('.').pop().toLowerCase()} />
154-
155-
<Button
156-
className="h-fit w-fit"
157-
kind="secondary"
158-
onClick={() => {
159-
item.modelResources.forEach((resource: any) => {
160-
// Construct the download URL for each resource
161-
const downloadUrl = `${process.env.NEXT_PUBLIC_BACKEND_URL}/api/download/resource/${resource.resource.id}`;
162-
// Open the URL in a new tab
163-
window.open(downloadUrl, '_blank');
164-
});
165-
}}
166-
>
167-
Download All Resources
168-
</Button>
169154
</div>
170155
{item?.modelResources?.length > 0 && (
171156
<div className="flex">
172157
<Accordion type="single" collapsible className="w-full">
173158
<AccordionItem value="item-1" className=" border-none">
174-
<AccordionTrigger className="flex w-full flex-wrap items-center gap-2 hover:no-underline">
175-
<div className=" text-baseBlueSolid8 ">
176-
See Resources
177-
</div>
178-
</AccordionTrigger>
159+
<div className="flex flex-wrap items-center justify-between">
160+
<AccordionTrigger className="flex w-full flex-wrap items-center gap-2 hover:no-underline">
161+
<div className=" text-baseBlueSolid8 ">
162+
See Resources
163+
</div>
164+
</AccordionTrigger>
165+
<Button
166+
className="h-fit w-fit"
167+
kind="secondary"
168+
onClick={() => {
169+
item.modelResources.forEach((resource: any) => {
170+
// Construct the download URL for each resource
171+
const downloadUrl = `${process.env.NEXT_PUBLIC_BACKEND_URL}/api/download/resource/${resource.resource.id}`;
172+
// Open the URL in a new tab
173+
window.open(downloadUrl, '_blank');
174+
});
175+
}}
176+
>
177+
Download All Resources
178+
</Button>
179+
</div>
179180
<AccordionContent
180181
className="flex w-full flex-col p-5"
181182
style={{

app/[locale]/(user)/datasets/[datasetIdentifier]/components/Resources/index.tsx

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -164,48 +164,51 @@ const Resources = () => {
164164
<Text>{item.description}</Text>
165165
</div>
166166
</div>
167-
<div className="align-center flex flex-col justify-between gap-4 sm:flex-row">
168-
<Dialog>
169-
<Dialog.Trigger>
170-
<Button className="h-fit w-fit" kind="secondary">
171-
View Fields
172-
</Button>
173-
</Dialog.Trigger>
174-
<Dialog.Content title={'View Fields'} limitHeight>
175-
<Table
176-
columns={[
177-
{
178-
accessorKey: 'name',
179-
header: 'Name',
180-
},
181-
{
182-
accessorKey: 'format',
183-
header: 'Format',
184-
},
185-
{
186-
accessorKey: 'description',
187-
header: 'Description',
188-
},
189-
]}
190-
rows={item.schema.map((item: any) => ({
191-
name: item.fieldName,
192-
format: item.format,
193-
description: item.description,
194-
}))}
195-
hideFooter={true}
196-
/>
197-
</Dialog.Content>
198-
</Dialog>
199-
</div>
167+
200168
{item?.accessModels?.length > 0 && (
201169
<div className="flex">
202170
<Accordion type="single" collapsible className="w-full">
203171
<AccordionItem value="item-1" className=" border-none">
204-
<AccordionTrigger className="flex w-full flex-wrap items-center gap-2 hover:no-underline ">
205-
<div className=" text-baseBlueSolid8 ">
206-
See Access Type
172+
<div className="flex flex-wrap items-center justify-between">
173+
<div className="align-center flex flex-col justify-between gap-4 sm:flex-row">
174+
<Dialog>
175+
<Dialog.Trigger>
176+
<Button className="h-fit w-fit" kind="secondary">
177+
View Fields
178+
</Button>
179+
</Dialog.Trigger>
180+
<Dialog.Content title={'View Fields'} limitHeight>
181+
<Table
182+
columns={[
183+
{
184+
accessorKey: 'name',
185+
header: 'Name',
186+
},
187+
{
188+
accessorKey: 'format',
189+
header: 'Format',
190+
},
191+
{
192+
accessorKey: 'description',
193+
header: 'Description',
194+
},
195+
]}
196+
rows={item.schema.map((item: any) => ({
197+
name: item.fieldName,
198+
format: item.format,
199+
description: item.description,
200+
}))}
201+
hideFooter={true}
202+
/>
203+
</Dialog.Content>
204+
</Dialog>
207205
</div>
208-
</AccordionTrigger>
206+
<AccordionTrigger className="flex w-full flex-wrap items-center gap-2 hover:no-underline ">
207+
<div className=" text-baseBlueSolid8 ">
208+
See Access Type
209+
</div>
210+
</AccordionTrigger>
211+
</div>
209212
<AccordionContent
210213
className="flex w-full flex-col "
211214
style={{

0 commit comments

Comments
 (0)