Skip to content

Commit

Permalink
Merge branch 'main' of github.com:mongodb/leafygreen-ui into LG-4105-…
Browse files Browse the repository at this point in the history
…codemod-scaffold
  • Loading branch information
shaneeza committed May 29, 2024
2 parents 0d150be + 34ac734 commit 7d8986a
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-ghosts-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/avatar': patch
---

Avatar `text` prop can now be `null` even when `format === 'text'`, allowing for a more seamless integration with the `getInitials` function. If `text === null`, the Avatar will fall back to `Icon` format.
5 changes: 5 additions & 0 deletions .changeset/tidy-bananas-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/icon': minor
---

Adds Stop to glyph set and updates Pause glyph
6 changes: 6 additions & 0 deletions chat/rich-links/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @lg-chat/rich-links

## 1.0.1

### Patch Changes

- 53ff5692: Fixes a malformed import & exports rich link variants

## 1.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion chat/rich-links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lg-chat/rich-links",
"version": "1.0.0",
"version": "1.0.1",
"description": "lg-chat Rich Links",
"main": "./dist/index.js",
"module": "./dist/esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlyphName } from '@leafygreen-ui/icon/src/glyphs';
import { GlyphName } from '@leafygreen-ui/icon';
import { DarkModeProps } from '@leafygreen-ui/lib';
import { BaseFontSize } from '@leafygreen-ui/tokens';

Expand Down
10 changes: 9 additions & 1 deletion chat/rich-links/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
export { RichLink, type RichLinkProps } from './RichLink';
export {
createRichLinkVariant,
type CreateRichLinkVariantArgs,
RichLink,
type RichLinkProps,
type RichLinkVariantMap,
type RichLinkVariantName,
richLinkVariants,
} from './RichLink';
export {
RichLinkBadge,
type RichLinkBadgeProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/avatar/src/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const TextAvatar: StoryObj<typeof Avatar> = {
},
generate: {
combineArgs: {
text: ['A', 'MW'],
text: ['A', 'MW', null],
},
},
},
Expand Down
10 changes: 9 additions & 1 deletion packages/avatar/src/Avatar/Avatar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ describe('packages/Avatar', () => {
<Avatar format="mongodb" />;
// Accepts (but ignores) `text` prop;
<Avatar format="mongodb" text="AT" />;
// Accepts (but ignores) null `text` prop;
<Avatar format="mongodb" text={null} />;
// Accepts (but ignores) `glyph` prop;
<Avatar format="mongodb" glyph="PersonGroup" />;

Expand All @@ -28,12 +30,16 @@ describe('packages/Avatar', () => {
<Avatar format="icon" glyph="NotAnIcon" />;
// Accepts (but ignores) `text` prop;
<Avatar format="icon" text="AT" />;
// Accepts (but ignores) null `text` prop;
<Avatar format="icon" text={null} />;

/**
* TEXT FORMAT
*/
// @ts-expect-error - Requires `text` prop
<Avatar format="text" />;
// Accepts null text prop
<Avatar format="text" text={null} />;
// Accepts text prop
<Avatar format="text" text="AT" />;
// Accepts (but ignores) `glyph` prop;
Expand All @@ -49,8 +55,10 @@ describe('packages/Avatar', () => {
Format.Text,
]) as Format;

// @ts-expect-error expects required props for all formats
// @ts-expect-error - requires defined text prop
<Avatar format={arbitraryFormat} />;
// Accepts null text prop
<Avatar format={arbitraryFormat} text={null} />;
// Accepts text prop
<Avatar format={arbitraryFormat} text="AT" />;
// Accepts glyph prop
Expand Down
6 changes: 3 additions & 3 deletions packages/avatar/src/Avatar/Avatar.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export type DiscriminatedAvatarProps =
/**
* The text to render in the Avatar when `format === 'text'`
*/
text: string;
text: string | null;

/**
* The LeafyGreen icon glyph name to render in the Avatar when `format === 'icon'`
Expand All @@ -78,7 +78,7 @@ export type DiscriminatedAvatarProps =
/**
* The text to render in the Avatar when `format === 'text'`
*/
text?: string;
text?: string | null;
}
| {
/**
Expand All @@ -89,7 +89,7 @@ export type DiscriminatedAvatarProps =
/**
* The text to render in the Avatar when `format === 'text'`
*/
text?: string;
text?: string | null;

/**
* The LeafyGreen icon glyph name to render in the Avatar when `format === 'icon'`
Expand Down
14 changes: 7 additions & 7 deletions packages/icon/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/icon/src/generated/Pause.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions packages/icon/src/generated/Stop.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/icon/src/glyphs/Pause.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icon/src/glyphs/Stop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/icon/src/glyphs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ import Sparkle from './Sparkle.svg';
import SplitHorizontal from './SplitHorizontal.svg';
import SplitVertical from './SplitVertical.svg';
import Stitch from './Stitch.svg';
import Stop from './Stop.svg';
import String from './String.svg';
import Sun from './Sun.svg';
import Support from './Support.svg';
Expand Down Expand Up @@ -292,6 +293,7 @@ const _glyphs = {
SplitHorizontal,
SplitVertical,
Stitch,
Stop,
String,
Sun,
Support,
Expand Down

0 comments on commit 7d8986a

Please sign in to comment.