File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /* As Markdown draws inline code (design/patterns/markdown.md): mono 12 on --bg-2, at
2+ --radius-control. A command that wraps keeps its padding on each line. */
3+ .code {
4+ box-decoration-break : clone;
5+ padding : 1px 4px ;
6+ border-radius : var (--radius-control );
7+ background-color : var (--bg-2 );
8+ font-size : 12px ;
9+ font-family : var (--font-family-mono );
10+ }
Original file line number Diff line number Diff line change 1+ import preview from "#storybook/preview" ;
2+ import { Code } from "./Code.tsx" ;
3+ import { EmptyState } from "./EmptyState.tsx" ;
4+
5+ const meta = preview . meta ( {
6+ title : "Content & status/Code" ,
7+ id : "components-code" ,
8+ component : Code ,
9+ } ) ;
10+
11+ export const Default = meta . story ( {
12+ args : {
13+ children : "but mesh service restart" ,
14+ } ,
15+ } ) ;
16+
17+ /** A command in a sentence, where it reads as part of the text. */
18+ export const InText = meta . story ( {
19+ render : ( ) => (
20+ < p className = "text-13" style = { { color : "var(--text-2)" } } >
21+ Run < Code > but config forge auth</ Code > there to connect GitHub.
22+ </ p >
23+ ) ,
24+ } ) ;
25+
26+ /** An empty state that says how to get out of it. */
27+ export const InEmptyState = meta . story ( {
28+ render : ( ) => (
29+ < EmptyState
30+ illustration = "cactus"
31+ title = "scott--mac-studio is offline"
32+ description = {
33+ < >
34+ Last seen 1d ago. Wake it up or run < Code > but mesh service restart</ Code > there; then its
35+ uncommitted changes can be loaded here.
36+ </ >
37+ }
38+ />
39+ ) ,
40+ } ) ;
Original file line number Diff line number Diff line change 1+ import styles from "./Code.module.css" ;
2+ import { classes } from "./classes.ts" ;
3+ import type { ComponentProps , FC } from "react" ;
4+
5+ /**
6+ * Code in running text: a command to run, a flag, a name to type. It reads as Markdown's inline
7+ * code does, so a command in an empty state or a hint looks the same as one in a description.
8+ * For a command the user is meant to take away, offer a copy button beside the text as well.
9+ *
10+ * @public
11+ * @import import { Code } from "@gitbutler/ui-react/Code.tsx";
12+ */
13+ export const Code : FC < ComponentProps < "code" > > = ( props ) => (
14+ < code { ...props } className = { classes ( props . className , styles . code ) } />
15+ ) ;
You can’t perform that action at this time.
0 commit comments