Skip to content

Commit 0c1038c

Browse files
fix: docs ui improvements
1 parent 259a025 commit 0c1038c

File tree

17 files changed

+100
-53
lines changed

17 files changed

+100
-53
lines changed

apps/www/src/components/datatable-demo.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ export const columns: DataTableColumnDef<Payment, unknown>[] = [
5454
checked={row.getIsSelected()}
5555
onCheckedChange={value => row.toggleSelected(!!value)}
5656
aria-label='Select row'
57+
style={{
58+
display: 'block'
59+
}}
5760
/>
5861
),
5962
enableSorting: false,

apps/www/src/components/demo/demo-controls.tsx

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { camelCaseToWords } from '@/lib/utils';
21
import {
32
InfoCircledIcon,
43
Pencil2Icon,
@@ -15,6 +14,7 @@ import {
1514
Text
1615
} from '@raystack/apsara';
1716
import { cx } from 'class-variance-authority';
17+
import { camelCaseToWords } from '@/lib/utils';
1818
import styles from './styles.module.css';
1919
import {
2020
ComponentPropsType,
@@ -48,6 +48,7 @@ export default function DemoControls({
4848
const propValue = componentProps?.[prop] ?? '';
4949
const isCheckbox = control.type === 'checkbox';
5050
const isIcon = control.type === 'icon';
51+
const isIconOptional = control.isIconOptional ?? true;
5152

5253
// For checkbox and icon types, render in a special container
5354
if (isCheckbox || isIcon) {
@@ -61,18 +62,20 @@ export default function DemoControls({
6162
<Text variant='secondary' size='small' weight='medium'>
6263
{propLabel}
6364
</Text>
64-
<Switch
65-
size='small'
66-
checked={!!componentProps[prop]}
67-
onCheckedChange={checked => {
68-
if (isCheckbox) onPropChange(prop, checked);
69-
else
70-
onPropChange(
71-
prop,
72-
checked ? String(ICONS_MAP.plus.value) : ''
73-
);
74-
}}
75-
/>
65+
{isIconOptional && (
66+
<Switch
67+
size='small'
68+
checked={!!componentProps[prop]}
69+
onCheckedChange={checked => {
70+
if (isCheckbox) onPropChange(prop, checked);
71+
else
72+
onPropChange(
73+
prop,
74+
checked ? String(ICONS_MAP.plus.value) : ''
75+
);
76+
}}
77+
/>
78+
)}
7679
</Flex>
7780
{isIcon && (
7881
<Flex gap={2} align='center' className={styles.iconContainer}>
@@ -90,6 +93,12 @@ export default function DemoControls({
9093
e.stopPropagation();
9194
}}
9295
aria-label={`Select ${icon.value || 'none'} icon`}
96+
style={{
97+
color:
98+
propValue === icon.value
99+
? 'var(--rs-color-background-accent-emphasis)'
100+
: undefined
101+
}}
93102
>
94103
{icon.icon}
95104
</IconButton>

apps/www/src/components/demo/demo.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
UploadIcon
99
} from '@radix-ui/react-icons';
1010
import * as Apsara from '@raystack/apsara';
11+
import dayjs from 'dayjs';
1112
import { Home, Info, Laugh, X } from 'lucide-react';
1213
import NextLink from 'next/link';
1314
import { Suspense } from 'react';
@@ -35,7 +36,8 @@ export default function Demo(props: DemoProps) {
3536
TransformIcon,
3637
Pencil2Icon,
3738
InfoCircledIcon,
38-
UploadIcon
39+
UploadIcon,
40+
dayjs
3941
}
4042
} = props;
4143

apps/www/src/components/demo/styles.module.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
min-height: 368px;
1212
display: flex;
1313
width: 100%;
14-
/* border-bottom: 0.5px solid var(--rs-color-border-base-primary); */
15-
max-height: 340px;
1614
}
1715

1816
.preview {
@@ -48,6 +46,7 @@
4846
overflow-x: hidden;
4947
overflow-y: auto;
5048
flex-shrink: 0;
49+
max-height: 400px;
5150
}
5251
.noShadow {
5352
box-shadow: none;

apps/www/src/components/demo/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type ControlType = {
3131
initialValue?: string | boolean;
3232
min?: number;
3333
max?: number;
34+
isIconOptional?: boolean;
3435
};
3536

3637
export type ControlsType = Record<string, ControlType>;

apps/www/src/components/mdx/mdx-components.module.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@
4444
margin-top: var(--rs-space-4);
4545
}
4646

47-
:global(.prose) ul,
48-
:global(.prose) ol {
47+
:global(.prose) ul:not([data-demo] ul),
48+
:global(.prose) ol:not([data-demo] ol) {
4949
padding-left: var(--rs-space-5);
5050
margin: 0;
5151
}
5252

53-
:global(.prose) ul li,
54-
:global(.prose) ol li {
53+
:global(.prose) ul:not([data-demo] ul) li,
54+
:global(.prose) ol:not([data-demo] ol) li {
5555
margin-bottom: var(--rs-space-3);
5656
}
57-
:global(.prose) ul li:first-child,
58-
:global(.prose) ol li:first-child {
57+
:global(.prose) ul:not([data-demo] ul) li:first-child,
58+
:global(.prose) ol:not([data-demo] ol) li:first-child {
5959
margin-top: var(--rs-space-3);
6060
}

apps/www/src/components/preview/preview.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
display: flex;
66
justify-content: center;
77
align-items: center;
8+
overflow: auto;
89
}

apps/www/src/components/typetable/typetable.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
line-height: var(--rs-line-height-mono-small);
4949
letter-spacing: var(--rs-letter-spacing-mono-small);
5050
color: var(--rs-color-foreground-base-primary);
51+
padding: var(--rs-space-3) var(--rs-space-4);
5152
}
5253

5354
.propName {
@@ -74,6 +75,10 @@
7475
background: transparent;
7576
padding: 0;
7677
}
78+
.fieldCode :global(.token-line) > span {
79+
display: flex;
80+
flex-wrap: wrap;
81+
}
7782

7883
.fieldLabel {
7984
width: 200px;

apps/www/src/content/docs/components/calendar/demo.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ export const preview = {
1414
},
1515
{
1616
name: 'Date Picker',
17-
code: `
18-
<Flex style={{height:200}}>
19-
<DatePicker />
20-
</Flex>`
17+
code: `<DatePicker />`
2118
}
2219
]
2320
};
@@ -116,7 +113,7 @@ export const dateInfoDemo = {
116113
gap={2}
117114
style={{ fontSize: '8px', color: 'var(--rs-color-foreground-base-secondary)' }}
118115
>
119-
<BellIcon style={{ width: '8px', height: '8px' }} />
116+
<Info style={{ width: '8px', height: '8px' }} />
120117
<Text style={{ fontSize: '8px' }} color='secondary'>25%</Text>
121118
</Flex>
122119
)

apps/www/src/content/docs/components/container/demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getPropsString } from '@/lib/utils';
55
export const getCode = (props: any) => {
66
const { children, ...rest } = props;
77

8-
return `<Container${getPropsString(rest)}>${children}</Container>`;
8+
return `<Container${getPropsString(rest)}><Text>${children}</Text></Container>`;
99
};
1010

1111
export const playground = {

0 commit comments

Comments
 (0)