-
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
Changes from 107 commits
ef34493
b71de4e
029a90e
6ef16ba
794fe08
2e19572
e21b374
07426d1
9994560
3af02dc
ffb7c2f
db94d82
68f6b57
02ede13
56c69e5
79f9394
ac0cadf
893f021
2fd12a6
a1d68a6
2a35411
f7164ca
05f3f67
9e108d7
d1ecc7b
b1f40b1
bbf2a2d
5b4276f
da970a8
696bcd7
597eba3
bf064a6
2b77d46
8a6c5e3
e41fac7
1e4a020
84c7542
d561827
b461adc
85037f5
90ab34c
f35d883
7b04bc6
c2fc2b0
fd23e6a
f45e3a7
eadcc1b
485b0fc
a5d6008
36972e5
f7611b1
a2a44f5
571a0c7
339e8be
3d284ed
3de4d8e
a02a756
e88a6f9
64aefdc
c45e257
6c42aa6
7e9898e
500ab13
5f5ecfb
8a8d39c
394ae5e
cd99321
db02b0e
4255681
6ca77cb
e1030de
149ff69
9a45d18
62f8b52
f43f0fb
a5123a1
10b22b5
9f0da7e
b4cd95f
b10b6f6
4975572
9a8bada
8184e9a
a3dd9c4
3ac48a6
bd339cf
a292195
ec6b9d4
b4dca10
d1f5264
2ac9395
56afc5a
facac67
a39be45
705a6c2
b9da5f9
7fcbe7f
e051c3c
55f6527
4e322db
e05cfda
cf28e29
dd51f84
1168eb3
33538df
1d1deb3
5f1c58c
49625f4
813d6f4
48a968a
daff28f
b8de180
b8ec8e5
0e23069
0cce4b0
e0d7288
40839f8
7dd19e7
3beac53
47b0a0d
a7ec53e
b5af1af
164f544
6923499
acb8e86
05b9e4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,140 @@ | ||||||
--- | ||||||
'@leafygreen-ui/code': major | ||||||
--- | ||||||
|
||||||
## What's new? | ||||||
|
||||||
### `panel` | ||||||
|
||||||
Adds a new slot prop, `panel`, that accepts the new `<Panel/>` sub-component. This 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. | ||||||
|
||||||
e.g. | ||||||
|
||||||
```js | ||||||
panel={ | ||||||
<Panel | ||||||
onChange={() => {}} | ||||||
languageOptions={[]} | ||||||
showCustomActionButtons | ||||||
customActionButtons={[]} | ||||||
title="Title" | ||||||
/> | ||||||
} | ||||||
``` | ||||||
or | ||||||
```js | ||||||
panel={<Panel/>} | ||||||
``` | ||||||
|
||||||
### `copyButtonAppearance` | ||||||
Adds a new prop, `copyButtonAppearance`. This prop determines the appearance of the copy button if the `panel` prop is not defined. If `panel` is defined, this prop will be ignored. | ||||||
|
||||||
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. | ||||||
|
||||||
e.g. | ||||||
|
||||||
```js | ||||||
<Code | ||||||
language="javascript" | ||||||
copyButtonAppearance="hover" | ||||||
> | ||||||
{snippet} | ||||||
</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. | ||||||
|
||||||
e.g. | ||||||
|
||||||
```js | ||||||
<Code | ||||||
language="javascript" | ||||||
isLoading | ||||||
> | ||||||
{snippet} | ||||||
</Code> | ||||||
``` | ||||||
|
||||||
|
||||||
### `chromeTitle` | ||||||
|
||||||
`<Panel/>` accepts the [deprecated `Code` props](https://github.com/mongodb/leafygreen-ui/tree/main/packages/code#deprecated) listed below, with one key difference: the `chromeTitle` prop has been replaced by `title`. Instead of rendering inside the window chrome bar, the `title` now appears within the top panel, as the window chrome bar has been removed. | ||||||
|
||||||
e.g. | ||||||
|
||||||
**Before**: | ||||||
```js | ||||||
<Code chromeTitle="title">{snippet}</Code> | ||||||
``` | ||||||
|
||||||
**After**: | ||||||
```js | ||||||
<Code | ||||||
panel={ <Panel title="Title" />} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very nit
Suggested change
|
||||||
> | ||||||
{snippet} | ||||||
</Code> | ||||||
``` | ||||||
|
||||||
## What's changed? | ||||||
|
||||||
The `className` prop is no longer applied to the `<pre>` tag. Instead it is applied to the parent `<div>` wrapper. | ||||||
|
||||||
|
||||||
## Deprecated | ||||||
|
||||||
The following props have been marked as `deprecated`: | ||||||
- `customActionButtons` | ||||||
- `showCustomActionButtons` | ||||||
- `chromeTitle` | ||||||
- `languageOptions` | ||||||
- `onChange` | ||||||
- `copyable` | ||||||
|
||||||
Moving forward these props should be passed to the new sub-component, `<Panel />`. | ||||||
|
||||||
**Before**: | ||||||
```js | ||||||
<Code | ||||||
language="javascript" | ||||||
showLineNumbers | ||||||
onCopy={() => {}} | ||||||
darkMode={true} | ||||||
onChange={() => {}} | ||||||
languageOptions={[]} | ||||||
showCustomActionButtons | ||||||
customActionButtons={[]} | ||||||
chromeTitle='Title' | ||||||
> | ||||||
{snippet} | ||||||
</Code> | ||||||
``` | ||||||
|
||||||
**After**: | ||||||
```js | ||||||
<Code | ||||||
language="javascript" | ||||||
showLineNumbers | ||||||
onCopy={() => {}} | ||||||
darkMode={true} | ||||||
// NEW PANEL PROP | ||||||
panel={ | ||||||
<Panel | ||||||
onChange={() => {}} | ||||||
languageOptions={[]} | ||||||
showCustomActionButtons | ||||||
customActionButtons={[]} | ||||||
title="Title" | ||||||
/> | ||||||
} | ||||||
> | ||||||
{snippet} | ||||||
</Code> | ||||||
``` | ||||||
|
||||||
Check out the [README](https://github.com/mongodb/leafygreen-ui/tree/main/packages/code#panel) for information on the `<Panel>` sub-component. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@leafygreen-ui/lib': minor | ||
--- | ||
|
||
Adds `getMobileMediaQuery` helper. This helper targets a specified screen size with no pointer, or a coarse pointer and no hover capability |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense! |
Large diffs are not rendered by default.
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.