RTL (right-to-left) layout (#1654)
* added rtl to body * added locale checkker in _document.tsx to check for ar or he locale * added rtl modifiers for event-types * added rtl classes * wip * wip Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
1 parent
d9bb8aacfc
commit
8bb3e9c0be
57 files changed
+203
-164
No files matched your search
@@ -27,7 +27,7 @@ export const AvatarGroup = function AvatarGroup(props: AvatarGroupProps) {
|
||||
: [];*/
|
||||
|
||||
return (
|
||||
<ul className={classNames("flex -space-x-2 overflow-hidden", props.className)}>
|
||||
<ul className={classNames("flex -rtl:space-x-reverse space-x-2 overflow-hidden", props.className)}>
|
||||
{props.items.slice(0, props.truncateAfter).map((item, idx) => {
|
||||
if (item.image != null) {
|
||||
return (
|
||||
|
||||
@@ -90,7 +90,12 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
||||
},
|
||||
<>
|
||||
{StartIcon && (
|
||||
<StartIcon className={classNames("inline", size === "icon" ? "w-5 h-5 " : "w-5 h-5 mr-2 -ml-1")} />
|
||||
<StartIcon
|
||||
className={classNames(
|
||||
"inline",
|
||||
size === "icon" ? "w-5 h-5 " : "w-5 h-5 ltr:mr-2 rtl:ml-2 rtl:ml-2 rtl:-mr-1 -ml-1"
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{props.children}
|
||||
{loading && (
|
||||
@@ -117,7 +122,7 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
{EndIcon && <EndIcon className="inline w-5 h-5 ml-2 -mr-1" />}
|
||||
{EndIcon && <EndIcon className="inline w-5 h-5 ltr:ml-2 rtl:mr-2 -mr-1" />}
|
||||
</>
|
||||
);
|
||||
return props.href ? (
|
||||
|
||||
@@ -12,7 +12,7 @@ export const DropdownMenuTrigger = forwardRef<HTMLButtonElement, DropdownMenuTri
|
||||
className={
|
||||
props.asChild
|
||||
? className
|
||||
: `relative inline-flex items-center px-3 py-2 ml-2 text-sm font-medium text-gray-700 bg-transparent rounded-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-1 focus:bg-gray-100 focus:ring-neutral-500 group-hover:text-black ${className}`
|
||||
: `relative inline-flex items-center px-3 py-2 ltr:ml-2 rtl:mr-2 text-sm font-medium text-gray-700 bg-transparent rounded-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-1 focus:bg-gray-100 focus:ring-neutral-500 group-hover:text-black ${className}`
|
||||
}
|
||||
ref={forwardedRef}
|
||||
/>
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function LinkIconButton(props: LinkIconButtonProps) {
|
||||
{...props}
|
||||
type="button"
|
||||
className="flex items-center px-2 py-1 text-sm font-medium text-gray-700 rounded-sm text-md hover:text-gray-900 hover:bg-gray-200">
|
||||
<props.Icon className="w-4 h-4 mr-2 text-neutral-500" />
|
||||
<props.Icon className="w-4 h-4 ltr:mr-2 rtl:ml-2 text-neutral-500" />
|
||||
{props.children}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function SettingInputContainer({
|
||||
<div className="block sm:flex">
|
||||
<div className="mb-4 min-w-48 sm:mb-0">
|
||||
<label htmlFor={htmlFor} className="flex mt-1 text-sm font-medium text-neutral-700">
|
||||
<Icon className="w-4 h-4 mr-2 mt-0.5 text-neutral-500" />
|
||||
<Icon className="w-4 h-4 ltr:mr-2 rtl:ml-2 mt-0.5 text-neutral-500" />
|
||||
{label}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@ export default function Switch(props: SwitchProps) {
|
||||
{label && (
|
||||
<Label.Root
|
||||
htmlFor={id}
|
||||
className="text-neutral-700 text-sm align-text-top ml-3 font-medium cursor-pointer">
|
||||
className="text-sm font-medium align-text-top cursor-pointer text-neutral-700 ltr:ml-3 rtl:mr-3">
|
||||
{label}
|
||||
</Label.Root>
|
||||
)}
|
||||
|
||||
@@ -24,7 +24,7 @@ const TableActions: FC<Props> = ({ actions }) => {
|
||||
const { t } = useLocale();
|
||||
return (
|
||||
<>
|
||||
<div className="space-x-2 hidden lg:block">
|
||||
<div className="rtl:space-x-reverse space-x-2 hidden lg:block">
|
||||
{actions.map((action) => (
|
||||
<Button
|
||||
key={action.id}
|
||||
@@ -74,7 +74,7 @@ const TableActions: FC<Props> = ({ actions }) => {
|
||||
"group flex items-center px-4 py-2 text-sm font-medium"
|
||||
)}>
|
||||
<action.icon
|
||||
className="mr-3 h-5 w-5 text-neutral-400 group-hover:text-neutral-500"
|
||||
className="ltr:mr-3 h-5 w-5 text-neutral-400 group-hover:text-neutral-500"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{action.label}
|
||||
|
||||
@@ -23,7 +23,7 @@ const CheckboxField = forwardRef<HTMLInputElement, Props>(({ label, description,
|
||||
className="w-4 h-4 border-gray-300 rounded focus:ring-primary-500 text-primary-600"
|
||||
/>
|
||||
</div>
|
||||
<div className="ml-3 text-sm">
|
||||
<div className="ltr:ml-3 rtl:mr-3 text-sm">
|
||||
<p className="text-neutral-900">{description}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -80,7 +80,7 @@ export const CheckedSelect = React.forwardRef((props: CheckedSelectProps, ref: F
|
||||
{selectedOptions.map((option) => (
|
||||
<div key={option.value} className="border border-1 p-2 font-medium">
|
||||
<Avatar
|
||||
className="w-6 h-6 rounded-full inline mr-2"
|
||||
className="w-6 h-6 rounded-full inline ltr:mr-2 rtl:ml-2"
|
||||
imageSrc={option.avatar}
|
||||
displayName={option.label}
|
||||
/>
|
||||
|
||||
@@ -17,7 +17,7 @@ export const DateRangePicker = ({ startDate, endDate, onDatesChange }: Props) =>
|
||||
className="border-gray-300 rounded-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm"
|
||||
clearIcon={null}
|
||||
calendarIcon={<CalendarIcon className="h-5 w-5 text-gray-500" />}
|
||||
rangeDivider={<ArrowRightIcon className="h-4 w-4 text-gray-400 mr-2" />}
|
||||
rangeDivider={<ArrowRightIcon className="h-4 w-4 text-gray-400 ltr:mr-2 rtl:ml-2" />}
|
||||
value={[startDate, endDate]}
|
||||
onChange={([startDate, endDate]) => {
|
||||
onDatesChange({ startDate, endDate });
|
||||
|
||||
@@ -123,7 +123,7 @@ const ScheduleBlock = ({ name, day, weekday }: ScheduleBlockProps) => {
|
||||
return (
|
||||
<fieldset className="flex flex-col space-y-2 sm:space-y-0 sm:flex-row justify-between py-5 min-h-[86px]">
|
||||
<div className="w-1/3">
|
||||
<label className="flex items-center space-x-2">
|
||||
<label className="flex items-center rtl:space-x-reverse space-x-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={fields.length > 0}
|
||||
@@ -136,7 +136,7 @@ const ScheduleBlock = ({ name, day, weekday }: ScheduleBlockProps) => {
|
||||
<div className="flex-grow">
|
||||
{fields.map((field, index) => (
|
||||
<div key={field.id} className="flex justify-between mb-1">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="flex items-center rtl:space-x-reverse space-x-2">
|
||||
<TimeRangeField name={`${name}.${day}.${index}`} />
|
||||
</div>
|
||||
<Button
|
||||
|
||||
@@ -142,7 +142,7 @@ export default function SetTimesModal(props) {
|
||||
<Button onClick={updateStartEndTimesHandler} type="submit">
|
||||
{t("save")}
|
||||
</Button>
|
||||
<Button onClick={props.onExit} type="button" color="secondary" className="mr-2">
|
||||
<Button onClick={props.onExit} type="button" color="secondary" className="ltr:mr-2">
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user