Skip to content
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

fix(breadcrumbs): add RTL support to the breadcrumbs component (#2486) #2487

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/red-terms-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/breadcrumbs": patch
---

Add RTL support to the breadcrumbs component
6 changes: 5 additions & 1 deletion packages/components/breadcrumbs/src/breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const Breadcrumbs = forwardRef<"div", BreadcrumbsProps>((props, ref) => {
children,
childCount,
itemProps,
separator = <ChevronRightIcon />,
separator = (
<div className="rtl:transform rtl:rotate-180">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrbadri all the tailwindcss styles should be in the theme package, this is because the users load the styles only from that folder https://nextui.org/docs/guide/installation#tailwind-css-setup so all tailwindcss classes out of there will not be compiled

<ChevronRightIcon />
</div>
),
maxItems,
itemsBeforeCollapse,
itemsAfterCollapse,
Expand Down
6 changes: 5 additions & 1 deletion packages/storybook/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React , { useEffect }from "react";
import {themes} from "@storybook/theming";
import {NextUIProvider} from "@nextui-org/system/src/provider";
import type {Preview} from "@storybook/react";
Expand All @@ -10,6 +10,10 @@ const decorators: Preview["decorators"] = [
const direction =
// @ts-ignore
locale && new Intl.Locale(locale)?.textInfo?.direction === "rtl" ? "rtl" : undefined;

useEffect(() => {
document.documentElement.style.setProperty("--direction", direction || "ltr");
}, [direction]);

return (
<NextUIProvider locale={locale}>
Expand Down
8 changes: 8 additions & 0 deletions packages/storybook/.storybook/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
@tailwind components;
@tailwind utilities;

:root {
--direction: ltr;
}

body {
direction: var(--direction);
}

h1 {
@apply text-4xl font-bold !text-foreground;
}
Expand Down
Loading