Skip to content

Commit 7e72726

Browse files
committed
Add feedback in codesandbox button
1 parent c3d5770 commit 7e72726

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

src/components/Header.tsx

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { memo } from 'react'
1+
import React, { memo, useState } from 'react'
22
import {
33
Box,
44
Switch,
@@ -18,23 +18,25 @@ import useDispatch from '../hooks/useDispatch'
1818
import { useSelector } from 'react-redux'
1919
import { getComponents } from '../core/selectors/components'
2020
import { getShowLayout, getShowCode } from '../core/selectors/app'
21-
// import { createShareUrl } from '../utils/share'
22-
// import useClipboard from '../hooks/useClipboard'
2321

2422
const CodeSandboxButton = () => {
2523
const components = useSelector(getComponents)
24+
const [isLoading, setIsLoading] = useState(false)
2625

2726
return (
2827
<Button
2928
onClick={async () => {
29+
setIsLoading(true)
3030
const code = await generateCode(components)
31+
setIsLoading(false)
3132
const parameters = buildParameters(code)
3233

3334
window.open(
3435
`https://codesandbox.io/api/v1/sandboxes/define?parameters=${parameters}`,
3536
'_blank',
3637
)
3738
}}
39+
isLoading={isLoading}
3840
rightIcon="external-link"
3941
variant="ghost"
4042
size="xs"
@@ -44,26 +46,6 @@ const CodeSandboxButton = () => {
4446
)
4547
}
4648

47-
/*
48-
const ShareButton = () => {
49-
const components = useSelector(getComponents)
50-
51-
const { onCopy, hasCopied } = useClipboard()
52-
53-
const copy = () => {
54-
if (onCopy) {
55-
onCopy(createShareUrl(components))
56-
}
57-
}
58-
59-
return (
60-
<Button onClick={copy} rightIcon="external-link" variant="ghost" size="xs">
61-
{hasCopied ? 'Copied' : 'Share'}
62-
</Button>
63-
)
64-
}
65-
*/
66-
6749
const Header = () => {
6850
const showLayout = useSelector(getShowLayout)
6951
const showCode = useSelector(getShowCode)

src/components/inspector/panels/components/IconButtonPanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const IconButtonPanel = () => {
2828
name="icon"
2929
>
3030
{Object.keys(theme.icons)
31-
.filter(icon => icon.includes(icon) || !icon)
32-
.map((icon, index) => (
33-
<ComboboxOption key={index} value={icon}>
34-
<Icon name={icon as Icons} /> <ComboboxOptionText />
31+
.filter(item => item.includes(icon) || !icon)
32+
.map((item, index) => (
33+
<ComboboxOption key={index} value={item}>
34+
<Icon name={item as Icons} /> <ComboboxOptionText />
3535
</ComboboxOption>
3636
))}
3737
</InputSuggestion>

src/utils/defaultProps.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const DEFAULT_PROPS: PreviewDefaultProps = {
170170
variant: 'subtle',
171171
},
172172
Box: Box.defaultProps,
173-
Button: { ...Button.defaultProps, children: 'Lorem Ipsum' },
173+
Button: { ...Button.defaultProps, children: 'Lorem Ipsum', variant: 'solid' },
174174
Divider: { borderColor: 'blackAlpha.500' },
175175
IconButton: {
176176
...IconButton.defaultProps,
@@ -183,7 +183,6 @@ export const DEFAULT_PROPS: PreviewDefaultProps = {
183183
...Image.defaultProps,
184184
height: '100px',
185185
width: '100px',
186-
fallbackSrc: 'https://via.placeholder.com/150',
187186
},
188187
Text: { ...Text.defaultProps, children: 'Lorem Ipsum' },
189188
Progress: { ...Progress.defaultProps, size: 'md' },

0 commit comments

Comments
 (0)