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

LG-4749: Code loading skeleton #2663

Merged
merged 126 commits into from
Jan 31, 2025

Conversation

shaneeza
Copy link
Collaborator

@shaneeza shaneeza commented Jan 27, 2025

✍️ Proposed changes

🎟 Jira ticket: LG-4749

This PR adds the isLoading prop. When this prop is true, 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

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have run pnpm changeset and documented my changes

For new components

  • I have added my new package to the global tsconfig
  • I have added my new package to the Table of Contents on the global README
  • I have verified the Live Example looks as intended on the design website.

🧪 How to test changes

@@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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.

title="Title"
/>
}
panel={ <Panel title="Title" />}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very nit

Suggested change
panel={ <Panel title="Title" />}
panel={<Panel title="Title" />}

@@ -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` |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
| `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}
Copy link
Collaborator

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,
);
Copy link
Collaborator

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!

@shaneeza shaneeza requested a review from sandynguyenn January 29, 2025 17:16
Base automatically changed from LG-4760/code-copy-button to LG-4657-code-improvements-integration January 30, 2025 18:38
@shaneeza shaneeza requested a review from tsck January 30, 2025 22:02
Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oof

Copy link
Collaborator Author

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense!

@shaneeza shaneeza requested a review from tsck January 31, 2025 16:15
@shaneeza shaneeza merged commit c8bc612 into LG-4657-code-improvements-integration Jan 31, 2025
10 of 11 checks passed
@shaneeza shaneeza deleted the LG-4749-code-isLoading branch January 31, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants