-
Notifications
You must be signed in to change notification settings - Fork 66
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
LG-4749: Code
loading skeleton
#2663
LG-4749: Code
loading skeleton
#2663
Conversation
… into LG-4760/code-copy-button
.changeset/chatty-ears-exercise.md
Outdated
@@ -45,6 +46,20 @@ e.g. | |||
</Code> | |||
``` | |||
|
|||
### `isLoading` | |||
Adds a new prop, `isLoading`. This prop determines whether or not the loading skeleton will be rendered in place of the code block. If 'true`, the language switcher and copy button will be disabled in the top panel. |
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.
Adds a new prop, `isLoading`. This prop determines whether or not the loading skeleton will be rendered in place of the code block. If 'true`, the language switcher and copy button will be disabled in the top panel. | |
Adds a new prop, `isLoading`. This prop determines whether or not the loading skeleton will be rendered in place of the code block. If `true`, the language switcher and copy button will be disabled in the top panel. |
.changeset/chatty-ears-exercise.md
Outdated
title="Title" | ||
/> | ||
} | ||
panel={ <Panel title="Title" />} |
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.
Very nit
panel={ <Panel title="Title" />} | |
panel={<Panel title="Title" />} |
packages/code/README.md
Outdated
@@ -87,6 +87,7 @@ const SomeComponent = () => ( | |||
| `highlightLines` | `Array<number` \| `[number, number]>` | An optional array of lines to highlight. The array can only contain numbers corresponding to the line numbers to highlight, and / or tuples representing a range (e.g. `[6, 10]`); | | | |||
| `copyButtonAppearance` | `'none'`, `'hover'`, `'persist'` | Determines the appearance of the copy button if the panel prop is not defined. If `panel` is defined, this prop will be ignored. The copy button allows the code block to be copied to the user's clipboard by clicking the button. If `hover`, the copy button will only appear when the user hovers over the code block. On mobile devices, the copy button will always be visible. If `persist`, the copy button will always be visible. If `none`, the copy button will not be rendered. | `hover` | | |||
| `panel` | `React.ReactNode` | Slot to pass the `<Panel/>` sub-component which will render the top panel with a language switcher, custom action buttons, and copy button. If no props are passed to the panel sub-component, the panel will render with only the copy button. | `` | | |||
| `isLoading` | `boolean` | Determines whether or not the loading skeleton will be rendered in place of the code block. If 'true`, the language switcher and copy button will be disabled in the top panel. | `false` | |
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.
| `isLoading` | `boolean` | Determines whether or not the loading skeleton will be rendered in place of the code block. If 'true`, the language switcher and copy button will be disabled in the top panel. | `false` | | |
| `isLoading` | `boolean` | Determines whether or not the loading skeleton will be rendered in place of the code block. If `true`, the language switcher and copy button will be disabled in the top panel. | `false` | |
@@ -60,6 +60,7 @@ export function LanguageSwitcherWithPanelExample({ | |||
|
|||
return ( | |||
<Code | |||
{...rest} |
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.
We're still spreading rest
on line 74 as well.
width: 100%; | ||
`, | ||
className, | ||
); |
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.
I like just passing the className
in here instead of also importing cx
into the component to combine them!
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.
Still have some text left over from conflict in this file
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.
oof
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.
This was hard to fix, so I copied it from the integration branch and added back the isLoading
prop
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.
Makes sense!
c8bc612
into
LG-4657-code-improvements-integration
✍️ Proposed changes
🎟 Jira ticket: LG-4749
This PR adds the
isLoading
prop. When this prop istrue
, the loading skeleton will render instead of the code block. If there is a panel, the language switcher and copy button will be disabled.✅ Checklist
For bug fixes, new features & breaking changes
pnpm changeset
and documented my changesFor new components
🧪 How to test changes