-
Notifications
You must be signed in to change notification settings - Fork 894
feat: Improve empty states for workspaces and templates #1950
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
Changes from 13 commits
7711138
d1ddfae
8796128
65678ab
d812056
df6bc50
eaf4a78
8d5e771
b7dbfff
c3ca61b
dfef339
5300bf8
114f65a
12a55cb
57e909d
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 |
---|---|---|
@@ -1,22 +1,25 @@ | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import { FC } from "react" | ||
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants" | ||
import { combineClasses } from "../../util/combineClasses" | ||
import { CopyButton } from "../CopyButton/CopyButton" | ||
|
||
export interface CodeExampleProps { | ||
code: string | ||
className?: string | ||
buttonClassName?: string | ||
Comment on lines
+9
to
+10
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. Thought: One thing to consider here is mimicking MUIs API. These use a
I'm adding this as a thought because it's not required to do anything now, just wanted to pose the question. Might make sense as a FE V topic. 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. I agree with you, but I see some components are already using the pattern |
||
} | ||
|
||
/** | ||
* Component to show single-line code examples, with a copy button | ||
*/ | ||
export const CodeExample: FC<CodeExampleProps> = ({ code }) => { | ||
export const CodeExample: FC<CodeExampleProps> = ({ code, className, buttonClassName }) => { | ||
const styles = useStyles() | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<code>{code}</code> | ||
<CopyButton text={code} /> | ||
<div className={combineClasses([styles.root, className])}> | ||
<code className={styles.code}>{code}</code> | ||
<CopyButton text={code} buttonClassName={combineClasses([styles.button, buttonClassName])} /> | ||
</div> | ||
) | ||
} | ||
|
@@ -30,8 +33,17 @@ const useStyles = makeStyles((theme) => ({ | |
background: theme.palette.background.default, | ||
color: theme.palette.primary.contrastText, | ||
fontFamily: MONOSPACE_FONT_FAMILY, | ||
fontSize: 13, | ||
padding: theme.spacing(2), | ||
fontSize: 14, | ||
borderRadius: theme.shape.borderRadius, | ||
padding: theme.spacing(0.5), | ||
}, | ||
code: { | ||
padding: `${theme.spacing(0.5)}px ${theme.spacing(0.75)}px ${theme.spacing(0.5)}px ${theme.spacing(2)}px`, | ||
}, | ||
button: { | ||
border: 0, | ||
minWidth: 42, | ||
minHeight: 42, | ||
borderRadius: theme.shape.borderRadius, | ||
}, | ||
})) |
Uh oh!
There was an error while loading. Please reload this page.