Skip to content

Commit 6e068bc

Browse files
committed
Improve RTL support example
1 parent 3f93526 commit 6e068bc

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.buttonSectionRtl {
2+
margin-left: var(--mantine-spacing-xs);
3+
margin-right: 0;
4+
}

app/examples/rtl-support/RTLSupportExample.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import { ActionIcon, Box, Button, DirectionProvider, Group, SegmentedControl, Stack, Text } from '@mantine/core';
44
import { IconColumns3, IconEdit, IconEye, IconTrash } from '@tabler/icons-react';
55
import { DataTable, useDataTableColumns, type DataTableSortStatus } from '__PACKAGE__';
6+
import clsx from 'clsx';
67
import { useMemo, useState } from 'react';
78
import { companies, employees, type Employee } from '~/data';
9+
import classes from './RTLSupportExample.module.css';
810

911
// Example 1: Basic table without pinned columns
1012
export function RTLBasicExample({ direction }: { direction: 'ltr' | 'rtl' }) {
@@ -46,7 +48,13 @@ export function RTLDraggingExample({ direction }: { direction: 'ltr' | 'rtl' })
4648
<Box dir={direction}>
4749
<Stack gap="xs">
4850
<Group gap="xs">
49-
<Button size="xs" variant="light" leftSection={<IconColumns3 size={16} />} onClick={resetColumnsOrder}>
51+
<Button
52+
classNames={{ section: clsx({ [classes.buttonSectionRtl]: direction === 'rtl' }) }}
53+
size="xs"
54+
variant="light"
55+
leftSection={<IconColumns3 size={16} />}
56+
onClick={resetColumnsOrder}
57+
>
5058
Reset order
5159
</Button>
5260
</Group>

app/examples/rtl-support/page.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ import { PageNavigation } from '~/components/PageNavigation';
77
import { PageTitle } from '~/components/PageTitle';
88
import { Txt } from '~/components/Txt';
99
import { readCodeFile } from '~/lib/code';
10-
import { getRouteMetadata } from '~/lib/utils';
10+
import { allPromiseProps, getRouteMetadata } from '~/lib/utils';
1111
import { RTLSupportExample } from './RTLSupportExample';
1212

1313
const PATH: Route = '/examples/rtl-support';
1414

1515
export const metadata = getRouteMetadata(PATH);
1616

1717
export default async function RTLSupportExamplePage() {
18-
const code = await readCodeFile<string>(`${PATH}/RTLSupportExample.tsx`);
18+
// const code = await readCodeFile<string>(`${PATH}/RTLSupportExample.tsx`);
19+
const code = await allPromiseProps({
20+
'RTLSupportExample.tsx': readCodeFile<string>(`${PATH}/RTLSupportExample.tsx`),
21+
'RTLSupportExample.module.css': readCodeFile<string>(`${PATH}/RTLSupportExample.module.css`),
22+
});
1923

2024
return (
2125
<>
@@ -35,7 +39,7 @@ export default async function RTLSupportExamplePage() {
3539
</Txt>
3640
<RTLSupportExample />
3741
<Txt>Here is the code:</Txt>
38-
<CodeBlock code={code} />
42+
<CodeBlock tabs={{ code, keys: ['RTLSupportExample.tsx', 'RTLSupportExample.module.css'] }} />
3943
<Txt>Head over to the next example to discover more features.</Txt>
4044
<PageNavigation of={PATH} />
4145
</>

0 commit comments

Comments
 (0)