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

feat: added RTL support to avatar and avatar group component #1727

Merged
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
7 changes: 7 additions & 0 deletions .changeset/tender-penguins-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@nextui-org/docs": patch
"@nextui-org/avatar": patch
"@nextui-org/theme": patch
---

feat: added RTL support to avatar and avatar group component
2 changes: 1 addition & 1 deletion apps/docs/content/components/avatar/group-custom-count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function App() {
max={3}
total={10}
renderCount={(count) => (
<p className="text-small text-foreground font-medium ml-2">+{count} others</p>
<p className="text-small text-foreground font-medium ms-2">+{count} others</p>
)}
>
<Avatar src="https://i.pravatar.cc/150?u=a042581f4e29026024d" />
Expand Down
2 changes: 1 addition & 1 deletion packages/components/avatar/src/use-avatar-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function useAvatarGroup(props: UseAvatarGroupProps = {}) {

const childProps = {
className: clsx(
isFirstAvatar ? "ml-0" : !isGrid ? "-ml-2" : "",
isFirstAvatar ? "ms-0" : !isGrid ? "-ms-2" : "",
isLastAvatar && remainingCount < 1 ? "hover:-translate-x-0" : "",
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const CustomCount = {
max: 3,
total: 10,
renderCount: (count: number) => (
<p className="text-sm text-black dark:text-white ml-2">+{count}</p>
<p className="text-sm text-black dark:text-white ms-2">+{count}</p>
),
},
};
4 changes: 2 additions & 2 deletions packages/core/theme/src/components/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const avatar = tv({
isInGroup: {
true: {
base: [
"-ml-2 data-[hover=true]:-translate-x-3 transition-transform",
"-ms-2 data-[hover=true]:-translate-x-3 transition-transform",
"data-[focus-visible=true]:-translate-x-3",
],
},
Expand Down Expand Up @@ -197,7 +197,7 @@ const avatarGroup = tv({

// calculated classNames
// src/components/avatar/src/use-avatar-group.ts
// -ml-2 hover:-translate-x-0 ml-0
// -ms-2 hover:-translate-x-0 ms-0

export type AvatarGroupVariantProps = VariantProps<typeof avatarGroup>;
export type AvatarVariantProps = VariantProps<typeof avatar>;
Expand Down
Loading