-
-
Notifications
You must be signed in to change notification settings - Fork 492
feat(accordion): add slide animation. #1659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KrotovM
wants to merge
2
commits into
themesberg:main
Choose a base branch
from
KrotovM:feat/accordion-animation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,163 @@ | ||
| import { Accordion, AccordionContent, AccordionPanel, AccordionTitle } from "flowbite-react"; | ||
| import type { CodeData } from "~/components/code-demo"; | ||
|
|
||
| const code = ` | ||
| import { Accordion, AccordionContent, AccordionPanel, AccordionTitle } from "flowbite-react"; | ||
|
|
||
| export function Component() { | ||
| return ( | ||
| <Accordion animate animationDuration={300}> | ||
| <AccordionPanel> | ||
| <AccordionTitle>What is Flowbite?</AccordionTitle> | ||
| <AccordionContent> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, | ||
| dropdowns, modals, navbars, and more. | ||
| </p> | ||
| <p className="text-gray-500 dark:text-gray-400"> | ||
| Check out this guide to learn how to | ||
| <a | ||
| href="https://flowbite.com/docs/getting-started/introduction/" | ||
| className="text-cyan-600 hover:underline dark:text-cyan-500" | ||
| > | ||
| get started | ||
| </a> | ||
| and start developing websites even faster with components on top of Tailwind CSS. | ||
| </p> | ||
| </AccordionContent> | ||
| </AccordionPanel> | ||
| <AccordionPanel> | ||
| <AccordionTitle>Is there a Figma file available?</AccordionTitle> | ||
| <AccordionContent> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| Flowbite is first conceptualized and designed using the Figma software so everything you see in the library | ||
| has a design equivalent in our Figma file. | ||
| </p> | ||
| <p className="text-gray-500 dark:text-gray-400"> | ||
| Check out the | ||
| <a href="https://flowbite.com/figma/" className="text-cyan-600 hover:underline dark:text-cyan-500"> | ||
| Figma design system | ||
| </a> | ||
| based on the utility classes from Tailwind CSS and components from Flowbite. | ||
| </p> | ||
| </AccordionContent> | ||
| </AccordionPanel> | ||
| <AccordionPanel> | ||
| <AccordionTitle>What are the differences between Flowbite and Tailwind UI?</AccordionTitle> | ||
| <AccordionContent> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| The main difference is that the core components from Flowbite are open source under the MIT license, whereas | ||
| Tailwind UI is a paid product. Another difference is that Flowbite relies on smaller and standalone | ||
| components, whereas Tailwind UI offers sections of pages. | ||
| </p> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| However, we actually recommend using both Flowbite, Flowbite Pro, and even Tailwind UI as there is no | ||
| technical reason stopping you from using the best of two worlds. | ||
| </p> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400">Learn more about these technologies:</p> | ||
| <ul className="list-disc pl-5 text-gray-500 dark:text-gray-400"> | ||
| <li> | ||
| <a href="https://flowbite.com/pro/" className="text-cyan-600 hover:underline dark:text-cyan-500"> | ||
| Flowbite Pro | ||
| </a> | ||
| </li> | ||
| <li> | ||
| <a | ||
| href="https://tailwindui.com/" | ||
| rel="nofollow" | ||
| className="text-cyan-600 hover:underline dark:text-cyan-500" | ||
| > | ||
| Tailwind UI | ||
| </a> | ||
| </li> | ||
| </ul> | ||
| </AccordionContent> | ||
| </AccordionPanel> | ||
| </Accordion> | ||
| ); | ||
| } | ||
| `; | ||
|
|
||
| export function Component() { | ||
| return ( | ||
| <Accordion animate animationDuration={300}> | ||
| <AccordionPanel> | ||
| <AccordionTitle>What is Flowbite?</AccordionTitle> | ||
| <AccordionContent> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, | ||
| dropdowns, modals, navbars, and more. | ||
| </p> | ||
| <p className="text-gray-500 dark:text-gray-400"> | ||
| Check out this guide to learn how to | ||
| <a | ||
| href="https://flowbite.com/docs/getting-started/introduction/" | ||
| className="text-cyan-600 hover:underline dark:text-cyan-500" | ||
| > | ||
| get started | ||
| </a> | ||
| and start developing websites even faster with components on top of Tailwind CSS. | ||
| </p> | ||
| </AccordionContent> | ||
| </AccordionPanel> | ||
| <AccordionPanel> | ||
| <AccordionTitle>Is there a Figma file available?</AccordionTitle> | ||
| <AccordionContent> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| Flowbite is first conceptualized and designed using the Figma software so everything you see in the library | ||
| has a design equivalent in our Figma file. | ||
| </p> | ||
| <p className="text-gray-500 dark:text-gray-400"> | ||
| Check out the | ||
| <a href="https://flowbite.com/figma/" className="text-cyan-600 hover:underline dark:text-cyan-500"> | ||
| Figma design system | ||
| </a> | ||
| based on the utility classes from Tailwind CSS and components from Flowbite. | ||
| </p> | ||
| </AccordionContent> | ||
| </AccordionPanel> | ||
| <AccordionPanel> | ||
| <AccordionTitle>What are the differences between Flowbite and Tailwind UI?</AccordionTitle> | ||
| <AccordionContent> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| The main difference is that the core components from Flowbite are open source under the MIT license, whereas | ||
| Tailwind UI is a paid product. Another difference is that Flowbite relies on smaller and standalone | ||
| components, whereas Tailwind UI offers sections of pages. | ||
| </p> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400"> | ||
| However, we actually recommend using both Flowbite, Flowbite Pro, and even Tailwind UI as there is no | ||
| technical reason stopping you from using the best of two worlds. | ||
| </p> | ||
| <p className="mb-2 text-gray-500 dark:text-gray-400">Learn more about these technologies:</p> | ||
| <ul className="list-disc pl-5 text-gray-500 dark:text-gray-400"> | ||
| <li> | ||
| <a href="https://flowbite.com/pro/" className="text-cyan-600 hover:underline dark:text-cyan-500"> | ||
| Flowbite Pro | ||
| </a> | ||
| </li> | ||
| <li> | ||
| <a | ||
| href="https://tailwindui.com/" | ||
| rel="nofollow" | ||
| className="text-cyan-600 hover:underline dark:text-cyan-500" | ||
| > | ||
| Tailwind UI | ||
| </a> | ||
| </li> | ||
| </ul> | ||
| </AccordionContent> | ||
| </AccordionPanel> | ||
| </Accordion> | ||
| ); | ||
| } | ||
|
|
||
| export const animation: CodeData = { | ||
| type: "single", | ||
| code: { | ||
| fileName: "index", | ||
| language: "tsx", | ||
| code, | ||
| }, | ||
| githubSlug: "accordion/accordion.animation.tsx", | ||
| component: <Component />, | ||
| }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export { animation } from "./accordion.animation"; | ||
| export { collapseAll } from "./accordion.collapseAll"; | ||
| export { root } from "./accordion.root"; |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard
animationDurationagainst invalid runtime values.Line 51 defaults only when the prop is
undefined; values like negative numbers/NaNstill flow through and can produce broken transition behavior downstream. Add a small clamp/sanitize step before passing it to panels.Suggested fix
🤖 Prompt for AI Agents