-
Notifications
You must be signed in to change notification settings - Fork 79
[LG-5664] feat(title-bar): add compact variant support #3275
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a944c4a
refactor(title-bar): reorg file structure and export Align
stephl3 97deeee
refactor(title-bar): styles and install lg chat provider peer dep
stephl3 7ecc80c
feat(title-bar): compact variant
stephl3 66e03a3
test(title-bar): update stories
stephl3 148bb99
docs(title-bar): readme
stephl3 24260a7
chore(title-bar): changeset
stephl3 edc8ad0
chore(title-bar): copilot feedback
stephl3 c0a0691
feat(chat-window): enable compact TitleBar in ChatWindow
stephl3 41c879c
fix: chat builds
stephl3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,6 @@ | ||
| --- | ||
| '@lg-chat/title-bar': minor | ||
| '@lg-chat/chat-window': minor | ||
| --- | ||
|
|
||
| [LG-5664](https://jira.mongodb.org/browse/LG-5664): add compact variant of `TitleBar` |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |
| ], | ||
| "@leafygreen-ui/*": [ | ||
| "../../packages/*/src" | ||
| ], | ||
| "@lg-chat/*": [ | ||
| "../*/src" | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
This file contains hidden or 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: 0 additions & 2 deletions
2
chat/fixed-chat-window/src/FixedChatWindow/FixedChatWindow.types.ts
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |
| ], | ||
| "@leafygreen-ui/*": [ | ||
| "../../packages/*/src" | ||
| ], | ||
| "@lg-chat/*": [ | ||
| "../*/src" | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |
| ], | ||
| "@leafygreen-ui/*": [ | ||
| "../../packages/*/src" | ||
| ], | ||
| "@lg-chat/*": [ | ||
| "../*/src" | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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,48 +1,104 @@ | ||
| import React from 'react'; | ||
| import { storybookArgTypes } from '@lg-tools/storybook-utils'; | ||
| import { StoryFn } from '@storybook/react'; | ||
| import { | ||
| LeafyGreenChatProvider, | ||
| Variant, | ||
| } from '@lg-chat/leafygreen-chat-provider'; | ||
| import { storybookArgTypes, StoryMetaType } from '@lg-tools/storybook-utils'; | ||
| import { StoryFn, StoryObj } from '@storybook/react'; | ||
|
|
||
| import { TitleBar } from '.'; | ||
| import { TitleBar, type TitleBarProps } from './TitleBar'; | ||
|
|
||
| export default { | ||
| const meta: StoryMetaType<typeof TitleBar> = { | ||
| title: 'Composition/Chat/TitleBar', | ||
| component: TitleBar, | ||
| args: { | ||
| title: 'LeafyGreen Chat', | ||
| onClose: undefined, | ||
| }, | ||
| argTypes: { | ||
| onClose: { control: 'none' }, | ||
| iconSlot: { control: 'none' }, | ||
| badgeText: { control: 'text' }, | ||
| darkMode: storybookArgTypes.darkMode, | ||
| }, | ||
| parameters: { | ||
| default: null, | ||
| generate: { | ||
| storyNames: ['CompactVariant', 'SpaciousVariant'], | ||
| combineArgs: { | ||
| badgeText: [undefined, 'Beta'], | ||
| darkMode: [false, true], | ||
| }, | ||
| decorator: (Instance, context) => { | ||
| return ( | ||
| <div style={{ width: 700 }}> | ||
| <LeafyGreenChatProvider variant={context?.args.variant}> | ||
| <Instance /> | ||
| </LeafyGreenChatProvider> | ||
| </div> | ||
| ); | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type TitleBarStoryProps = TitleBarProps & { | ||
| variant?: Variant; | ||
| }; | ||
|
|
||
| const Template: StoryFn<typeof TitleBar> = props => ( | ||
| const Template: StoryFn<TitleBarStoryProps> = ({ variant, ...props }) => ( | ||
| <div style={{ width: 700 }}> | ||
| <TitleBar {...props} /> | ||
| <LeafyGreenChatProvider variant={variant}> | ||
| <TitleBar {...props} /> | ||
| </LeafyGreenChatProvider> | ||
| </div> | ||
| ); | ||
|
|
||
| export const Centered = Template.bind({}); | ||
| export const LiveExample: StoryObj<TitleBarStoryProps> = { | ||
| render: Template, | ||
| args: { | ||
| title: 'LeafyGreen Chat', | ||
| }, | ||
| parameters: { | ||
| chromatic: { | ||
| disableSnapshot: true, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export const LeftAligned = Template.bind({}); | ||
| LeftAligned.args = { | ||
| align: 'left', | ||
| export const CompactVariant: StoryObj<TitleBarStoryProps> = { | ||
| render: Template, | ||
| args: { | ||
| title: 'LeafyGreen Chat', | ||
| variant: Variant.Compact, | ||
| }, | ||
| }; | ||
|
|
||
| export const WithBeta = Template.bind({}); | ||
| WithBeta.args = { | ||
| badgeText: 'Beta', | ||
| export const SpaciousVariant: StoryObj<TitleBarStoryProps> = { | ||
| render: Template, | ||
| args: { | ||
| title: 'LeafyGreen Chat', | ||
| variant: Variant.Spacious, | ||
| }, | ||
| }; | ||
|
|
||
| export const CenteredWithClose = Template.bind({}); | ||
| CenteredWithClose.args = { | ||
| onClose: () => {}, | ||
| export const LeftAligned: StoryObj<TitleBarStoryProps> = { | ||
| render: Template, | ||
| args: { | ||
| title: 'LeafyGreen Chat', | ||
| variant: Variant.Spacious, | ||
| align: 'left', | ||
| onClose: undefined, | ||
| }, | ||
| }; | ||
|
|
||
| export const LeftAlignedWithClose = Template.bind({}); | ||
| LeftAlignedWithClose.args = { | ||
| align: 'left', | ||
| onClose: () => {}, | ||
| export const WithCloseButton: StoryObj<TitleBarStoryProps> = { | ||
| render: Template, | ||
| args: { | ||
| title: 'LeafyGreen Chat', | ||
| variant: Variant.Spacious, | ||
| // eslint-disable-next-line no-console | ||
| onClose: () => console.log('Close clicked'), | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we don't use storybook actions in our stories?
https://storybook.js.org/docs/essentials/actions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No specific reason other than we just haven't adopted it more broadly. Definitely something we could do