-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
170 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,81 @@ | ||
--- | ||
title: RichIcon | ||
description: TBD | ||
description: A rich icon component is used to render a rich custom icon. | ||
category: "icons" | ||
links: | ||
source: https://github.com/gsoft-inc/wl-hopper/blob/main/packages/icons/src/RichIcon.tsx | ||
status: WIP | ||
--- | ||
|
||
## Props | ||
<Example src="icons/docs/richIcon/preview" isOpen /> | ||
|
||
Similar to icons, RichIcons are vibrant and colorful. Perfect for decorative purposes or drawing attention to specific elements. | ||
|
||
Hopper provides multiple ways to use rich icons in your project: | ||
|
||
- Using the [Workleap icon library](/icons/overview/introduction) | ||
- [Creating your own icons](#creating-your-custom-rich-icons) | ||
|
||
## Creating your custom rich icons | ||
|
||
TODO: Add the props table, if we have multiple props table (ex: TagList and Tag) in the same file, use the name of the component in ### before the each props table | ||
To use an rich icon component to create custom rich icons you must first import your SVG icon as a component by using [`@svgr/webpack`](https://react-svgr.com/docs/getting-started/). | ||
|
||
## Guidelines | ||
Hopper provides two methods for creating your custom icons: | ||
|
||
TODO: If we have some guidelines about this component's usage | ||
- Using the `createRichIcon` function (recommended) | ||
- Using the `RichIcon` component | ||
|
||
### Accessibility ? | ||
Both `RichIcon` and `createRichIcon` enable you to style the icon using the styled system. | ||
|
||
TODO: If we have some guidelines about this component and accessibility | ||
### Using the createRichIcon function | ||
|
||
## Anatomy | ||
The `createRichIcon` function is a convenience wrapper around the process of generating rich icons with `RichIcon`, allowing you to achieve the same functionality with less effort. | ||
|
||
TODO: We have anatomy screenshots from the Figma, we could most likely use them here | ||
```tsx {6} | ||
import CustomRichIcon24 from "./path/to/custom-rich-icon-24.svg"; | ||
import CustomRichIcon32 from "./path/to/custom-rich-icon-32.svg"; | ||
import CustomRichIcon40 from "./path/to/custom-rich-icon-40.svg"; | ||
import { createRichIcon } from "@hopper-ui/icons"; | ||
|
||
### Concepts | ||
const CustomRichIcon = createRichIcon(CustomRichIcon24, CustomRichIcon32, CustomRichIcon40, "CustomIcon") | ||
``` | ||
|
||
TODO: links to related concepts | ||
### Using the RichIcon component | ||
|
||
### Composed Components | ||
```tsx {8-12} | ||
import CustomRichIcon24 from "./path/to/custom-icon-24.svg" | ||
import CustomRichIcon32 from "./path/to/custom-icon-32.svg" | ||
import CustomRichIcon40 from "./path/to/custom-icon-40.svg" | ||
import { Icon, type CreatedRichIconProps } from "@hopper-ui/icons"; | ||
|
||
TODO: links to related components (most likely all component which are used by the slots) | ||
function CustomRichIcon(props: CreatedRichIconProps) { | ||
return ( | ||
<RichIcon | ||
src24={CustomIcon24} | ||
src32={CustomRichIcon24} | ||
src40={CustomRichIcon32} | ||
{...props} /> | ||
) | ||
} | ||
``` | ||
|
||
## Usage | ||
### Sizes | ||
|
||
## Advanced customization | ||
A rich icon can vary in size. When used inside another component, it'll generally be sized automatically. If you use a standalone icon, you can use the size prop to control the sizing. | ||
|
||
### Contexts | ||
TODO: Example of context + content about the context | ||
<Example src="icons/docs/richIcon/sizes" /> | ||
|
||
### Custom Children | ||
### Styling | ||
|
||
TODO: Example of passing custom childrens to the components to fake a slot | ||
The color of the rich icon can be changed using the `fill` prop. All the styled system props are also available. | ||
|
||
### Custom Component | ||
<Example src="icons/docs/richIcon/styling" /> | ||
|
||
TODO: Example of creating a custom version of this component | ||
### Variants | ||
|
||
The color of the rich icon can be changed using the `variant` prop. | ||
|
||
<Example src="icons/docs/richIcon/variants" /> | ||
|
||
## Props | ||
|
||
## Migration Notes (WIP) | ||
<PropTable component="RichIcon" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/icons/docs/preview.tsx → packages/icons/docs/icon/preview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/icons/docs/sizes.tsx → packages/icons/docs/icon/sizes.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/icons/docs/styling.tsx → packages/icons/docs/icon/styling.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createRichIcon } from "@hopper-ui/icons"; | ||
|
||
import { SparklesRichIcon24, SparklesRichIcon32, SparklesRichIcon40 } from "../src/index.ts"; | ||
|
||
const CustomRichIcon = createRichIcon(SparklesRichIcon24, SparklesRichIcon32, SparklesRichIcon40, "SparklesRichIcon"); | ||
|
||
export default function Example() { | ||
return ( | ||
<CustomRichIcon /> | ||
); | ||
} | ||
|
||
|
Oops, something went wrong.