Skip to content

Commit 8e94a19

Browse files
authored
docs: use lucide-react for RAC example's icons (#8516)
* use lucide-react for RAC example's icons * up contrast in CheckCircle in shipping-radio example * update icon in image-grid example * improve shopping-list example
1 parent 94f0575 commit 8e94a19

File tree

11 files changed

+38
-41
lines changed

11 files changed

+38
-41
lines changed

packages/react-aria-components/docs/examples/action-menu.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ import './tailwind.global.css';
3939
```tsx example standalone
4040
import {MenuTrigger, Button, Popover, Menu, MenuItem, Separator} from 'react-aria-components';
4141
import type {MenuItemProps} from 'react-aria-components';
42-
import RailIcon from '@spectrum-icons/workflow/Rail';
42+
import {Menu as MenuIcon} from 'lucide-react';
4343

4444
function MenuExample() {
4545
return (
4646
<div className="bg-linear-to-r to-blue-500 from-violet-500 p-8 h-[250px] rounded-lg">
4747
<MenuTrigger>
48-
<Button aria-label="Menu" className="inline-flex items-center justify-center rounded-md bg-black/20 bg-clip-padding border border-white/20 px-3 py-2 text-white hover:bg-black/30 pressed:bg-black/40 transition-colors cursor-default outline-hidden focus-visible:ring-2 focus-visible:ring-white/75"><RailIcon size="S" /></Button>
48+
<Button aria-label="Menu" className="inline-flex items-center justify-center rounded-md bg-black/20 bg-clip-padding border border-white/20 px-3 py-2 text-white hover:bg-black/30 pressed:bg-black/40 transition-colors cursor-default outline-hidden focus-visible:ring-2 focus-visible:ring-white/75"><MenuIcon className="w-4 h-4" /></Button>
4949
<Popover className="p-1 w-56 overflow-auto rounded-md bg-white shadow-lg ring-1 ring-black/5 entering:animate-in entering:fade-in entering:zoom-in-95 exiting:animate-out exiting:fade-out exiting:zoom-out-95 fill-mode-forwards origin-top-left">
5050
<Menu className="outline-hidden">
5151
<ActionItem id="new">New…</ActionItem>

packages/react-aria-components/docs/examples/datepicker.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ import './tailwind.global.css';
4343
```tsx example standalone
4444
import {DatePicker, Label, Group, Heading, DateInput, DateSegment, Button, Popover, Dialog, Calendar, CalendarGrid, CalendarGridHeader, CalendarHeaderCell, CalendarGridBody, CalendarCell} from 'react-aria-components';
4545
import type {ButtonProps, PopoverProps} from 'react-aria-components';
46-
import ChevronUpDownIcon from '@spectrum-icons/workflow/ChevronUpDown';
47-
import ChevronLeftIcon from '@spectrum-icons/workflow/ChevronLeft';
48-
import ChevronRightIcon from '@spectrum-icons/workflow/ChevronRight';
46+
import {ChevronLeft, ChevronRight, ChevronsUpDown} from 'lucide-react';
4947

5048
function DatePickerExample() {
5149
return (
@@ -57,16 +55,16 @@ function DatePickerExample() {
5755
{(segment) => <DateSegment segment={segment} className="px-0.5 tabular-nums outline-hidden rounded-xs focus:bg-violet-700 focus:text-white caret-transparent placeholder-shown:italic" />}
5856
</DateInput>
5957
<Button className="outline-hidden px-3 flex items-center text-gray-700 transition border-0 border-solid border-l border-l-purple-200 bg-transparent rounded-r-lg pressed:bg-purple-100 focus-visible:ring-2 ring-black">
60-
<ChevronUpDownIcon size="XS" />
58+
<ChevronsUpDown className="w-4 h-4" />
6159
</Button>
6260
</Group>
6361
<MyPopover>
6462
<Dialog className="p-6 text-gray-600">
6563
<Calendar>
6664
<header className="flex items-center gap-1 pb-4 px-1 font-serif w-full">
6765
<Heading className="flex-1 font-semibold text-2xl ml-2" />
68-
<RoundButton slot="previous"><ChevronLeftIcon /></RoundButton>
69-
<RoundButton slot="next"><ChevronRightIcon /></RoundButton>
66+
<RoundButton slot="previous"><ChevronLeft /></RoundButton>
67+
<RoundButton slot="next"><ChevronRight /></RoundButton>
7068
</header>
7169
<CalendarGrid className="border-spacing-1 border-separate">
7270
<CalendarGridHeader>

packages/react-aria-components/docs/examples/destructive-dialog.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import './tailwind.global.css';
3838

3939
```tsx example standalone
4040
import {DialogTrigger, Button, ModalOverlay, Modal, Dialog, Heading} from 'react-aria-components';
41-
import AlertIcon from '@spectrum-icons/workflow/Alert';
41+
import {AlertTriangle} from 'lucide-react';
4242

4343
function ModalExample() {
4444
return (
@@ -58,7 +58,7 @@ function ModalExample() {
5858
<Dialog role="alertdialog" className="outline-hidden relative">
5959
{({ close }) => (<>
6060
<Heading slot="title" className="text-xxl font-semibold leading-6 my-0 text-slate-700">Delete folder</Heading>
61-
<div className="w-6 h-6 text-red-500 absolute right-0 top-0 stroke-2"><AlertIcon size="M" /></div>
61+
<div className="w-6 h-6 text-red-500 absolute right-0 top-0 stroke-2"><AlertTriangle className="w-6 h-6" /></div>
6262
<p className="mt-3 text-slate-500">
6363
Are you sure you want to delete "Documents"? All contents will be permanently destroyed.
6464
</p>

packages/react-aria-components/docs/examples/file-system.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const filesystem = [
8282

8383
```tsx example standalone
8484
import {Button, Collection, Tree, TreeItem, TreeItemContent} from 'react-aria-components';
85-
import ChevronIcon from '@spectrum-icons/ui/ChevronRightMedium';
85+
import {ChevronRight} from 'lucide-react';
8686

8787
function FileSystemExample() {
8888
return (
@@ -104,7 +104,7 @@ function FileSystemExample() {
104104
{hasChildItems ? <Button slot="chevron" className={`shrink-0 w-8 h-8
105105
group-data-[expanded=true]:rotate-90 transition-rotate duration-200
106106
inline-flex items-center justify-center bg-transparent border-0 me-0
107-
cursor-default outline-hidden text-white`}><ChevronIcon /></Button> : <div className="shrink-0 w-8 h-8" />}
107+
cursor-default outline-hidden text-white`}><ChevronRight className="w-4 h-4" /></Button> : <div className="shrink-0 w-8 h-8" />}
108108
<div>{item.name}</div>
109109
</div>
110110
)}

packages/react-aria-components/docs/examples/image-grid.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import './tailwind.global.css';
3838
```tsx example standalone
3939
import {ListBox, ListBoxItem, Text, ProgressBar} from 'react-aria-components';
4040
import {useAsyncList} from 'react-stately';
41-
import CheckCircleIcon from '@spectrum-icons/workflow/CheckmarkCircle';
41+
import {CheckCircle2} from 'lucide-react';
4242

4343
type Item = {
4444
user: { name: string },
@@ -73,7 +73,7 @@ function ImageGridExample() {
7373
<img src={item.urls.regular} alt={item.alt_description} className="h-[80px] w-full object-cover rounded-sm group-selected:ring-2 group-focus-visible:ring-4 group-selected:group-focus-visible:ring-4 ring-offset-2 ring-sky-600" />
7474
<Text slot="label" className="text-[11px] text-gray-700 font-semibold overflow-hidden text-ellipsis whitespace-nowrap max-w-full block mt-1">{item.user.name}</Text>
7575
<div className="absolute top-2 left-2 text-sky-800 rounded-full leading-0 bg-white border border-white border-solid hidden group-selected:block">
76-
<CheckCircleIcon size="S" />
76+
<CheckCircle2 className="h-6 w-6" />
7777
</div>
7878
</ListBoxItem>
7979
)}

packages/react-aria-components/docs/examples/notifications-popover.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ import './tailwind.global.css';
4040
```tsx example standalone
4141
import {DialogTrigger, Button, Popover, OverlayArrow, Dialog, Link} from 'react-aria-components';
4242
import type {PopoverProps} from 'react-aria-components';
43-
import BellIcon from '@spectrum-icons/workflow/Bell';
44-
import ChatIcon from '@spectrum-icons/workflow/Chat';
43+
import {Bell, MessageSquare} from 'lucide-react';
4544

4645
function PopoverExample() {
4746
return (
4847
<div className="bg-linear-to-r from-orange-400 to-pink-600 p-8 rounded-lg sm:h-[300px] flex items-start justify-center">
4948
<DialogTrigger>
5049
<Button aria-label="Notifications" className="inline-flex items-center justify-center rounded-md bg-black/20 bg-clip-padding border border-white/20 px-3.5 py-2 font-medium text-white hover:bg-black/30 pressed:bg-black/40 transition-colors cursor-default outline-hidden focus-visible:ring-2 focus-visible:ring-white/75">
51-
<BellIcon size="S" />
50+
<Bell className="w-6 h-6" />
5251
</Button>
5352
<MyPopover>
5453
<OverlayArrow>
@@ -86,7 +85,7 @@ function Notification({avatar, name, time, text}) {
8685
<Link href="#" className="p-2 rounded-lg hover:bg-gray-100 grid grid-cols-[theme(width.5)_1fr_theme(width.4)] gap-x-2 text-[inherit] no-underline outline-hidden focus-visible:ring-2 ring-pink-800">
8786
<img src={avatar} className="rounded-full w-5 h-5 row-span-3" />
8887
<div className="text-gray-800 font-semibold leading-5">{name}</div>
89-
<div className="text-gray-400"><ChatIcon size="XS" /></div>
88+
<div className="text-gray-400"><MessageSquare className="w-4 h-4" /></div>
9089
<div className="text-sm text-gray-500 col-span-2">Commented {time} ago</div>
9190
<p className="text-sm overflow-hidden text-ellipsis line-clamp-2 mt-1 mb-0 col-span-2">{text}</p>
9291
</Link>

packages/react-aria-components/docs/examples/ripple-button.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import './tailwind.global.css';
3737
```tsx example standalone
3838
import {Button} from 'react-aria-components';
3939
import {useEffect, useRef, useState} from 'react';
40-
import Airplane from '@spectrum-icons/workflow/Airplane';
40+
import {Plane} from 'lucide-react';
4141

4242
function RippleButton(props) {
4343
const [coords, setCoords] = useState(null);
@@ -80,7 +80,7 @@ function RippleButton(props) {
8080
)
8181
}
8282

83-
<RippleButton><Airplane size="S" /> Book flight</RippleButton>
83+
<RippleButton><Plane className="w-6 h-6" /> Book flight</RippleButton>
8484
```
8585
```css
8686
@keyframes ripple {

packages/react-aria-components/docs/examples/shipping-radio.mdx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import './tailwind.global.css';
3636

3737
```tsx example standalone
3838
import {RadioGroup, Radio, Label} from 'react-aria-components';
39-
import CheckCircleIcon from '@spectrum-icons/workflow/CheckmarkCircle';
39+
import {CheckCircle, Circle} from 'lucide-react';
4040

4141
function RadioGroupExample() {
4242
return (
@@ -60,18 +60,20 @@ function ShippingOption({name, time, price}) {
6060
${isPressed && !isSelected ? 'bg-blue-50' : ''}
6161
${!isSelected && !isPressed ? 'bg-white' : ''}
6262
`}>
63-
<div className="flex w-full items-center justify-between gap-3">
64-
<div className="flex items-center shrink-0 text-blue-100 group-selected:text-white">
65-
<CheckCircleIcon size="M" />
66-
</div>
67-
<div className="flex flex-1 flex-col">
68-
<div className="text-lg font-serif font-semibold text-gray-900 group-selected:text-white">{name}</div>
69-
<div className="inline text-gray-500 group-selected:text-sky-100">
70-
{time}
63+
{({isSelected}) => (
64+
<div className="flex w-full items-center justify-between gap-3">
65+
<div className="flex items-center shrink-0 text-blue-400 group-selected:text-white">
66+
{isSelected ? <CheckCircle className="w-6 h-6" /> : <Circle className="w-6 h-6" />}
67+
</div>
68+
<div className="flex flex-1 flex-col">
69+
<div className="text-lg font-serif font-semibold text-gray-900 group-selected:text-white">{name}</div>
70+
<div className="inline text-gray-500 group-selected:text-sky-100">
71+
{time}
72+
</div>
7173
</div>
74+
<div className="font-medium font-mono text-gray-900 group-selected:text-white">{price}</div>
7275
</div>
73-
<div className="font-medium font-mono text-gray-900 group-selected:text-white">{price}</div>
74-
</div>
76+
)}
7577
</Radio>
7678
);
7779
}

packages/react-aria-components/docs/examples/status-select.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ import './tailwind.global.css';
4040
```tsx example standalone
4141
import {Select, Label, Button, SelectValue, Popover, ListBox, ListBoxItem} from 'react-aria-components';
4242
import type {ListBoxItemProps} from 'react-aria-components';
43-
import ChevronUpDownIcon from '@spectrum-icons/workflow/ChevronUpDown';
44-
import CheckIcon from '@spectrum-icons/workflow/Checkmark';
43+
import {ChevronsUpDown, Check} from 'lucide-react';
4544

4645
function SelectExample() {
4746
return (
@@ -50,7 +49,7 @@ function SelectExample() {
5049
<Label className="text-white cursor-default">Status</Label>
5150
<Button className="flex items-center cursor-default rounded-lg border-0 bg-white/90 pressed:bg-white transition py-2 pl-5 pr-2 text-base text-left leading-normal shadow-md text-gray-700 focus:outline-hidden focus-visible:ring-2 ring-white ring-offset-2 ring-offset-rose-700">
5251
<SelectValue className="flex-1 truncate placeholder-shown:italic" />
53-
<ChevronUpDownIcon size="XS" />
52+
<ChevronsUpDown className="w-4 h-4" />
5453
</Button>
5554
<Popover className="max-h-60 w-(--trigger-width) overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black/5 entering:animate-in entering:fade-in exiting:animate-out exiting:fade-out">
5655
<ListBox className="outline-hidden p-1">
@@ -90,7 +89,7 @@ function StatusItem(props: ListBoxItemProps & {children: React.ReactNode}) {
9089
<>
9190
<span className="flex-1 flex items-center gap-2 truncate font-normal group-selected:font-medium">{props.children}</span>
9291
<span className="w-5 flex items-center text-rose-600 group-focus:text-white">
93-
{isSelected && <CheckIcon size="S" />}
92+
{isSelected && <Check className="w-4 h-4" />}
9493
</span>
9594
</>
9695
)}

packages/react-aria-components/docs/examples/stock-table.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const stocks = [{"id":1,"symbol":"PAACR","name":"Pacific Special Acquisition Cor
8888
```tsx example standalone
8989
import {Table, TableHeader, TableBody, Column, Row, Cell, ResizableTableContainer, ColumnResizer, Group} from 'react-aria-components';
9090
import type {ColumnProps, RowProps, CellProps, SortDescriptor} from 'react-aria-components';
91-
import ArrowUpIcon from '@spectrum-icons/ui/ArrowUpSmall';
91+
import {ArrowUp} from 'lucide-react';
9292
import {useState, useMemo} from 'react';
9393

9494
function StockTableExample() {
@@ -142,7 +142,7 @@ function StockColumn(props: ColumnProps & {children: React.ReactNode}) {
142142
<span className="flex-1 truncate">{props.children}</span>
143143
{allowsSorting && (
144144
<span className={`ml-1 w-4 h-4 flex items-center justify-center transition ${sortDirection === 'descending' ? 'rotate-180' : ''}`}>
145-
{sortDirection && <ArrowUpIcon width={8} height={10} />}
145+
{sortDirection && <ArrowUp className="w-4 h-4" />}
146146
</span>
147147
)}
148148
</Group>

0 commit comments

Comments
 (0)