forked from hauptrolle/chakra-templates
-
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.
Merge pull request hauptrolle#270 from fernandounger/main
feat: add simple accordion component
- Loading branch information
Showing
3 changed files
with
104 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { SubCategory } from '../types'; | ||
|
||
export const accordion: SubCategory = { | ||
name: 'Accordion', | ||
id: 'accordion', | ||
children: [ | ||
{ | ||
name: 'Simple Accordion', | ||
filename: 'simpleAccordion', | ||
}, | ||
], | ||
}; |
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
83 changes: 83 additions & 0 deletions
83
src/pages/templates/components/accordion/simpleAccordion.tsx
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,83 @@ | ||
import { | ||
Accordion, | ||
AccordionItem, | ||
AccordionButton, | ||
AccordionPanel, | ||
Flex, | ||
useColorModeValue, | ||
Text, | ||
Container, | ||
} from '@chakra-ui/react'; | ||
|
||
import { ChevronDownIcon } from '@chakra-ui/icons'; | ||
|
||
export default function SimpleAccordion() { | ||
return ( | ||
<Flex | ||
minH={'100vh'} | ||
align={'center'} | ||
justify={'center'} | ||
bg={useColorModeValue('gray.50', 'gray.800')}> | ||
<Container> | ||
<Accordion allowMultiple width="100%" maxW="lg" bg="white" rounded="lg"> | ||
<AccordionItem> | ||
<AccordionButton | ||
display="flex" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
p={4} | ||
_hover={{ bg: 'gray.100' }}> | ||
<Text fontSize="md">What is Chakra UI?</Text> | ||
<ChevronDownIcon fontSize="24px" /> | ||
</AccordionButton> | ||
<AccordionPanel pb={4}> | ||
<Text> | ||
Chakra UI is a simple and modular component library that gives | ||
developers the building blocks they need to create web | ||
applications. | ||
</Text> | ||
</AccordionPanel> | ||
</AccordionItem> | ||
<AccordionItem> | ||
<AccordionButton | ||
display="flex" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
p={4} | ||
_hover={{ bg: 'gray.100' }}> | ||
<Text fontSize="md">What advantages to use?</Text> | ||
<ChevronDownIcon fontSize="24px" /> | ||
</AccordionButton> | ||
<AccordionPanel pb={4}> | ||
<Text> | ||
Chakra UI offers a variety of advantages including ease of use, | ||
accessibility, and customization options. It also provides a | ||
comprehensive set of UI components and is fully compatible with | ||
React. | ||
</Text> | ||
</AccordionPanel> | ||
</AccordionItem> | ||
<AccordionItem> | ||
<AccordionButton | ||
display="flex" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
p={4} | ||
_hover={{ bg: 'gray.100' }}> | ||
<Text fontSize="md">How to start using Chakra UI?</Text> | ||
<ChevronDownIcon fontSize="24px" /> | ||
</AccordionButton> | ||
<AccordionPanel pb={4}> | ||
<Text> | ||
To get started with Chakra UI, you can install it via npm or | ||
yarn, and then import the components you need in your project. | ||
The Chakra UI documentation is also a great resource for getting | ||
started and learning more about the library. | ||
</Text> | ||
</AccordionPanel> | ||
</AccordionItem> | ||
</Accordion> | ||
</Container> | ||
</Flex> | ||
); | ||
} |