Skip to content

Commit 6803b67

Browse files
committed
feat(docs): docs-native Icon component, drop @ably/ui/core/Icon (DX-1128)
Vendor a local Icon that renders only Ably's own glyphs (product, social, tech, gui-prod). Heroicons are now imported directly from @heroicons/react as components at each call site, so they tree-shake instead of going through a name->component lookup that bundles the whole set. This keeps the custom Icon's responsibility narrow and matches the direction for the rest of the vendored components.
1 parent b94efdf commit 6803b67

94 files changed

Lines changed: 402 additions & 127 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/components/Icon/glyphs/

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ data/onPostBuild/__fixtures__/*.mdx
99

1010
# Vendored @ably/ui design tokens, reset and component CSS (DX-1128) - do not reformat
1111
src/styles/ui/
12+
13+
# Vendored @ably/ui icon glyphs (DX-1128) - do not reformat
14+
src/components/Icon/glyphs/

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@codesandbox/sandpack-react": "^2.20.0",
4646
"@codesandbox/sandpack-themes": "^2.0.21",
4747
"@gfx/zopfli": "^1.0.15",
48+
"@heroicons/react": "^2.2.0",
4849
"@mdx-js/react": "^2.3.0",
4950
"@radix-ui/react-accordion": "^1.2.12",
5051
"@radix-ui/react-dropdown-menu": "^2.1.16",

src/components/Examples/ExamplesCheckbox.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import Icon from '@ably/ui/core/Icon';
32
import cn from 'src/utilities/cn';
3+
import { CheckIcon } from '@heroicons/react/24/outline';
44

55
const ExamplesCheckbox = ({
66
label,
@@ -35,10 +35,9 @@ const ExamplesCheckbox = ({
3535
data-ui-checkbox-styled=""
3636
className={cn(['ui-checkbox-styled', disabled && '!border-neutral-800 !bg-orange-600'])}
3737
>
38-
<Icon
39-
size="1rem"
40-
name="icon-gui-check-outline"
41-
additionalCSS={cn(['ui-checkbox-styled-tick cursor-pointer', disabled && 'text-neutral-000'])}
38+
<CheckIcon
39+
className={cn('size-[1rem]', cn(['ui-checkbox-styled-tick cursor-pointer', disabled && 'text-neutral-000']))}
40+
aria-hidden
4241
/>
4342
</div>
4443
<label htmlFor={name} className="ui-text-p4 text-neutral-900">

src/components/Examples/ExamplesFilter.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { ChangeEvent, Dispatch, SetStateAction, useCallback, useEffect, useMemo, useRef, useState } from 'react';
22
import ReactDOM from 'react-dom';
3-
import Icon from '@ably/ui/core/Icon';
43
import { Input } from 'src/components/ui/Input';
54
import { products } from '../../data/examples';
65
import Button from '@ably/ui/core/Button';
@@ -11,6 +10,7 @@ import { SelectedFilters } from './ExamplesContent';
1110
import { useOnClickOutside } from 'src/hooks/use-on-click-outside';
1211
import { navigate } from 'gatsby';
1312
import { ProductName } from '@ably/ui/core/ProductTile/data';
13+
import { MagnifyingGlassIcon, XMarkIcon } from '@heroicons/react/24/outline';
1414

1515
const ExamplesFilter = ({
1616
selected,
@@ -113,10 +113,9 @@ const ExamplesFilter = ({
113113
return (
114114
<>
115115
<div className="relative w-full">
116-
<Icon
117-
name="icon-gui-magnifying-glass-outline"
118-
size="16px"
119-
additionalCSS="absolute left-3 top-1/2 -translate-y-1/2 z-10 text-neutral-600 dark:text-neutral-700 pointer-events-none"
116+
<MagnifyingGlassIcon
117+
className="size-[16px] absolute left-3 top-1/2 -translate-y-1/2 z-10 text-neutral-600 dark:text-neutral-700 pointer-events-none"
118+
aria-hidden
120119
/>
121120
<Input
122121
type="search"
@@ -154,7 +153,7 @@ const ExamplesFilter = ({
154153
<div className="flex justify-between items-center sm:hidden h-16 px-4 py-2 bg-neutral-000 dark:bg-neutral-1300 border border-neutral-300 dark:border-neutral-1000 rounded-t-2xl sm:rounded-none">
155154
<p className="ui-text-p1 font-bold text-neutral-1300 dark:text-neutral-000">Filters</p>
156155
<button onClick={closeFilterMenu} aria-label="Close filter menu">
157-
<Icon name="icon-gui-x-mark-outline" size="24px" />
156+
<XMarkIcon className="size-[24px]" aria-hidden />
158157
</button>
159158
</div>
160159
{filters.map(({ key, selected, handleSelect, data }) => (

src/components/Examples/ExamplesGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useCallback } from 'react';
22
import Badge from '@ably/ui/core/Badge';
3-
import Icon from '@ably/ui/core/Icon';
4-
import { IconName } from '@ably/ui/core/Icon/types';
3+
import Icon from 'src/components/Icon';
4+
import { IconName } from 'src/components/Icon/types';
55
import { ProductName, products as dataProducts } from '@ably/ui/core/ProductTile/data';
66
import cn from 'src/utilities/cn';
77
import { Image, ImageProps } from '../Image';

src/components/Examples/ExamplesRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CodeEditor } from 'src/components/CodeEditor';
55
import { LanguageKey } from 'src/data/languages/types';
66
import { ExampleFiles, ExampleWithContent } from 'src/data/examples/types';
77
import { updateAblyConnectionKey } from 'src/utilities/update-ably-connection-keys';
8-
import { IconName } from '@ably/ui/core/Icon/types';
8+
import { IconName } from 'src/components/Icon/types';
99
import SegmentedControl from '@ably/ui/core/SegmentedControl';
1010
import dotGrid from './images/dot-grid.svg';
1111
import cn from 'src/utilities/cn';

src/components/Icon/glyphs/icon-gui-ably-badge.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Icon/glyphs/icon-gui-prod-ai-transport-outline.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Icon/glyphs/icon-gui-prod-ai-transport-solid.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)