-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/f 39 implement generic accordion component (#12)
* feat: implement accordion and card component * rename icons and refactor code * Fix: remove css files, remove unused import * fix(accordion/card): accordion/card function name, adjust overflow of content, adjust operations * fix(accordion/card): adjust color scheme of accordion and card * fix(lint): adjust lint errors * fix(tailwind): instead of custom css use tailwind * fix(color): fix color for accordion/card * fix(accordion/card): fix overflow text style * fix(accordion): fix overflow in accordion content * fix(accordion): fix accordion's title alignment * feat(accordion): add accordion call in page.tsx --------- Co-authored-by: Armanpreet Ghotra <[email protected]> Co-authored-by: Bohdan Garchu <[email protected]>
- Loading branch information
1 parent
f287c0a
commit 0adcbda
Showing
19 changed files
with
6,712 additions
and
9,455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use client'; | ||
|
||
import { Accordion, AccordionItem } from '@nextui-org/accordion'; | ||
|
||
import { AccordionsProps } from '@/domain/props/AccordionProps'; | ||
|
||
export default function CustomAccordion({ items }: AccordionsProps) { | ||
return ( | ||
<div className="w-full flex justify-start items-start max-w-[600px] overflow-visible overflow-x-auto p-2 rounded-lg"> | ||
<Accordion variant="splitted"> | ||
{items.map((item) => ( | ||
<AccordionItem | ||
key={item.title} | ||
aria-label={item.title} | ||
className="last:border-b-[none] dark:bg-black white:bg-white overflow-x-auto" | ||
title={ | ||
<div className="flex justify-between items-center w-full"> | ||
<span>{item.title}</span> | ||
{item.iconSrc && <img src={item.iconSrc} alt="info icon" className="w-[37px] h-[37px] p-[5.5px]" />} | ||
</div> | ||
} | ||
> | ||
{typeof item.content === 'string' ? ( | ||
<div className="p-4 break-words text-balance">{item.content}</div> | ||
) : ( | ||
item.content | ||
)} | ||
</AccordionItem> | ||
))} | ||
</Accordion> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use client'; | ||
|
||
import { Card, CardBody, CardHeader, Image } from '@nextui-org/react'; | ||
|
||
import { CardProps } from '@/domain/props/CardProps'; | ||
|
||
export default function CustomCard({ title, content }: CardProps) { | ||
return ( | ||
<Card className="w-fit h-auto min-w-[210px] justify-evenly m-2.5 dark:primary white:bg-white"> | ||
<CardHeader className="flex flex-col items-center p-[5px] overflow-visible"> | ||
<h2 className="text-large break-words text-pretty"> {title} </h2> | ||
</CardHeader> | ||
<CardBody className="flex flex-col items-center justify-center overflow-visible overflow-y-auto max-h-[300px] py-2"> | ||
<div className="flex flex-row gap-6 overflow-y-auto"> | ||
{content.map((item) => ( | ||
<div key={item.text} className="flex flex-col gap-[3px] items-center"> | ||
<div className="imageWrapper"> | ||
<Image alt={item.altText} className="w-[102px] h-[75px]" src={item.imageSrc} /> | ||
</div> | ||
<h1 className="text-base text-center mt-2">{item.text}</h1> | ||
{item.timeText && <h1 className="text-xs text-[#888888] text-center break-words">{item.timeText}</h1>} | ||
</div> | ||
))} | ||
</div> | ||
</CardBody> | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface AccordionItemProps { | ||
title: string; | ||
iconSrc?: string; | ||
content: React.ReactNode | string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface CardContent { | ||
imageSrc: string; | ||
text: string; | ||
timeText?: string; | ||
altText: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { AccordionItemProps } from '../entities/accordions/Accordions'; | ||
|
||
export interface AccordionsProps { | ||
items: AccordionItemProps[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { CardContent } from '../entities/cards/Cards'; | ||
|
||
export interface CardProps { | ||
title: string; | ||
content: CardContent[]; | ||
} |
Oops, something went wrong.