Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/18885 migrate avatar token #19080

Merged
merged 6 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export enum AvatarNetworkSize {
* Props for the AvatarNetwork component
*/
export interface AvatarNetworkStyleUtilityProps
extends Omit<AvatarBaseStyleUtilityProps, 'size'> {
extends Omit<AvatarBaseStyleUtilityProps, 'size' | 'children'> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@georgewrmarshall double-check that this is the right solution.

Before

Screenshot 2023-07-25 at 3 55 24 PM

After

Screenshot 2023-07-25 at 3 55 41 PM

Copy link
Contributor

@georgewrmarshall georgewrmarshall Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense to my limited TypeScript knowledged brain. We are adjusting the types at the same level we are increasing the specificity of the component. We can omit the children prop because we are supplying the children using the <img /> element or fallbackString I think it makes more sense that making children optional on the AvatarBase level

/**
* The name accepts the string to render the first alphabet of the Avatar Name
*/
Expand Down
48 changes: 23 additions & 25 deletions ui/components/component-library/avatar-token/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ The `AvatarToken` is a component responsible for display of the image of a given

## Props

The `AvatarToken` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props
The `AvatarToken` accepts all props below as well as all [Box](/docs/components-componentlibrary-box--docs#props) component props

<ArgsTable of={AvatarToken} />

### Size

Use the `size` prop to set the size of the `AvatarToken`.
Use the `size` prop and the `AvatarTokenSize` enum to change the size of `AvatarToken`. Defaults to `IconSize.Sm`

Possible sizes include:

- `xs` 16px
- `sm` 24px
- `md` 32px
- `lg` 40px
- `xl` 48px
- `AvatarTokenSize.Xs` 16px
- `AvatarTokenSize.Sm` 24px
- `AvatarTokenSize.Md` 32px
- `AvatarTokenSize.Lg` 40px
- `AvatarTokenSize.Xl` 48px

Defaults to `md`
Defaults to `AvatarTokenSize.Md`

The fallback display of the `AvatarToken` is a circle with the initial letter of the network name. The size of the initial letter is calculated based on the size of the `AvatarToken` component.

Expand All @@ -37,13 +37,13 @@ The fallback display of the `AvatarToken` is a circle with the initial letter of
</Canvas>

```jsx
import { AvatarToken } from '../../component-library';
import { AvatarToken, AvatarTokenSize } from '../../component-library';

<AvatarToken size={Size.XS} />
<AvatarToken size={Size.SM} />
<AvatarToken size={Size.MD} />
<AvatarToken size={Size.LG} />
<AvatarToken size={Size.XL} />
<AvatarToken size={AvatarTokenSize.Xs} />
<AvatarToken size={AvatarTokenSize.Sm} />
<AvatarToken size={AvatarTokenSize.Md} />
<AvatarToken size={AvatarTokenSize.Lg} />
<AvatarToken size={AvatarTokenSize.Xl} />
```

### Name
Expand Down Expand Up @@ -104,24 +104,22 @@ Use the `color`, `backgroundColor` and `borderColor` props to set the text color
</Canvas>

```jsx
import { TextColor,
BackgroundColor,
BorderColor, } from '../../../helpers/constants/design-system';
import { TextColor, BackgroundColor, BorderColor, } from '../../../helpers/constants/design-system';
import { AvatarToken } from '../../component-library';

<AvatarToken
backgroundColor={BackgroundColor.goerli}
borderColor={BorderColor.goerli}
name="G"
color={Color.primaryInverse}
backgroundColor={BackgroundColor.goerli}
borderColor={BorderColor.goerli}
name="G"
color={Color.primaryInverse}
>
G
</AvatarToken>
<AvatarToken
backgroundColor={BackgroundColor.sepolia}
borderColor={BorderColor.sepolia}
name="S"
color={Color.primaryInverse}
backgroundColor={BackgroundColor.sepolia}
borderColor={BorderColor.sepolia}
name="S"
color={Color.primaryInverse}
>
S
</AvatarToken>
Expand Down

This file was deleted.

133 changes: 0 additions & 133 deletions ui/components/component-library/avatar-token/avatar-token.js

This file was deleted.

Loading