Skip to content

Commit 4f585ca

Browse files
authored
Merge branch 'main' into datadog
2 parents 763367e + 4cd0261 commit 4f585ca

File tree

8 files changed

+797
-104
lines changed

8 files changed

+797
-104
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ require (
2727
github.com/pion/datachannel v1.5.2
2828
github.com/pion/logging v0.2.2
2929
github.com/pion/transport v0.13.0
30-
github.com/pion/webrtc/v3 v3.1.21
30+
github.com/pion/webrtc/v3 v3.1.22
3131
github.com/quasilyte/go-ruleguard/dsl v0.3.16
3232
github.com/spf13/cobra v1.3.0
3333
github.com/stretchr/testify v1.7.0
3434
github.com/unrolled/secure v1.0.9
3535
go.uber.org/atomic v1.9.0
3636
go.uber.org/goleak v1.1.12
37-
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8
37+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838
3838
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
3939
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
4040
google.golang.org/protobuf v1.27.1
@@ -84,7 +84,7 @@ require (
8484
github.com/opencontainers/go-digest v1.0.0 // indirect
8585
github.com/opencontainers/image-spec v1.0.2 // indirect
8686
github.com/opencontainers/runc v1.1.0 // indirect
87-
github.com/pion/dtls/v2 v2.1.1 // indirect
87+
github.com/pion/dtls/v2 v2.1.2 // indirect
8888
github.com/pion/ice/v2 v2.1.20 // indirect
8989
github.com/pion/interceptor v0.1.7 // indirect
9090
github.com/pion/mdns v0.0.5 // indirect

go.sum

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,9 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
10051005
github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
10061006
github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6E=
10071007
github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ=
1008-
github.com/pion/dtls/v2 v2.1.1 h1:+ak8AXk2Hw0xjBTwC3ZwTmg72nLckNs3kpIugs4R594=
10091008
github.com/pion/dtls/v2 v2.1.1/go.mod h1:qG3gA7ZPZemBqpEFqRKyURYdKEwFZQCGb7gv9T3ON3Y=
1009+
github.com/pion/dtls/v2 v2.1.2 h1:22Q1Jk9L++Yo7BIf9130MonNPfPVb+YgdYLeyQotuAA=
1010+
github.com/pion/dtls/v2 v2.1.2/go.mod h1:o6+WvyLDAlXF7YiPB/RlskRoeK+/JtuaZa5emwQcWus=
10101011
github.com/pion/ice/v2 v2.1.20 h1:xpxXyX5b4WjCh/D905gzBeW/hbJxMEPx2ptVfrhVE6M=
10111012
github.com/pion/ice/v2 v2.1.20/go.mod h1:hEAldRzBhTtAfvlU1V/2/nLCMvveQWFKPNCop+63/Iw=
10121013
github.com/pion/interceptor v0.1.7 h1:HThW0tIIKT9RRoDWGURe8rlZVOx0fJHxBHpA0ej0+bo=
@@ -1040,8 +1041,8 @@ github.com/pion/turn/v2 v2.0.6 h1:AsXjSPR6Im15DMTB39NlfdTY9BQfieANPBjdg/aVNwY=
10401041
github.com/pion/turn/v2 v2.0.6/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw=
10411042
github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o=
10421043
github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M=
1043-
github.com/pion/webrtc/v3 v3.1.21 h1:6b/65m5hSw2mF+sssHBx7Q2WPccklA0U0veEYtqZSuM=
1044-
github.com/pion/webrtc/v3 v3.1.21/go.mod h1:dIT2ETlP5dnlkgp46fAH56UizvOKuXJ9ySgFkhtmBbw=
1044+
github.com/pion/webrtc/v3 v3.1.22 h1:B6WeQVX+hD5d/i1TdV6CV70we9HuT/thgdn/x+e6xvk=
1045+
github.com/pion/webrtc/v3 v3.1.22/go.mod h1:L5S/oAhL0Fzt/rnftVQRrP80/j5jygY7XRZzWwFx6P4=
10451046
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
10461047
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
10471048
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
@@ -1307,8 +1308,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
13071308
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
13081309
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
13091310
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
1310-
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 h1:kACShD3qhmr/3rLmg1yXyt+N4HcwutKyPRB93s54TIU=
1311-
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
1311+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE=
1312+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
13121313
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
13131314
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
13141315
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { CodeBlock, CodeBlockProps } from "./index"
4+
5+
const sampleLines = `Successfully assigned coder/image-jcws7 to cluster-1
6+
Container image "gcr.io/coder-dogfood/master/coder-dev-ubuntu@sha256" already present on machine
7+
Created container user
8+
Started container user
9+
Using user 'coder' with shell '/bin/bash'`.split("\n")
10+
11+
export default {
12+
title: "CodeBlock",
13+
component: CodeBlock,
14+
argTypes: {
15+
lines: { control: "object", defaultValue: sampleLines },
16+
},
17+
}
18+
19+
const Template: Story<CodeBlockProps> = (args: CodeBlockProps) => <CodeBlock {...args} />
20+
21+
export const Example = Template.bind({})
22+
Example.args = {
23+
lines: sampleLines,
24+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { screen } from "@testing-library/react"
2+
import { render } from "../../test_helpers"
3+
import React from "react"
4+
import { CodeBlock } from "./index"
5+
6+
describe("CodeBlock", () => {
7+
it("renders lines)", async () => {
8+
// When
9+
render(<CodeBlock lines={["line1", "line2"]} />)
10+
11+
// Then
12+
// Both lines should be rendered
13+
await screen.findByText("line1")
14+
await screen.findByText("line2")
15+
})
16+
})

site/components/CodeBlock/index.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { makeStyles } from "@material-ui/core/styles"
2+
import React from "react"
3+
4+
export interface CodeBlockProps {
5+
lines: string[]
6+
}
7+
8+
export const CodeBlock: React.FC<CodeBlockProps> = ({ lines }) => {
9+
const styles = useStyles()
10+
11+
return (
12+
<div className={styles.root}>
13+
{lines.map((line, idx) => (
14+
<div className={styles.line} key={idx}>
15+
{line}
16+
</div>
17+
))}
18+
</div>
19+
)
20+
}
21+
const MONOSPACE_FONT_FAMILY =
22+
"'Fira Code', 'Lucida Console', 'Lucida Sans Typewriter', 'Liberation Mono', 'Monaco', 'Courier New', Courier, monospace"
23+
24+
const useStyles = makeStyles((theme) => ({
25+
root: {
26+
minHeight: 156,
27+
background: theme.palette.background.default,
28+
color: theme.palette.codeBlock.contrastText,
29+
fontFamily: MONOSPACE_FONT_FAMILY,
30+
fontSize: 13,
31+
wordBreak: "break-all",
32+
padding: theme.spacing(2),
33+
borderRadius: theme.shape.borderRadius,
34+
},
35+
line: {
36+
whiteSpace: "pre-wrap",
37+
},
38+
}))

site/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"@material-ui/core": "4.9.4",
2222
"@material-ui/icons": "4.5.1",
2323
"@material-ui/lab": "4.0.0-alpha.42",
24-
"@react-theming/storybook-addon": "1.1.3",
24+
"@react-theming/storybook-addon": "1.1.5",
2525
"@storybook/addon-actions": "6.3.12",
2626
"@storybook/addon-essentials": "6.3.12",
2727
"@storybook/addon-links": "6.3.12",
28-
"@storybook/react": "6.3.12",
28+
"@storybook/react": "6.4.18",
2929
"@testing-library/react": "12.1.2",
3030
"@types/express": "4.17.13",
3131
"@types/jest": "27.4.0",

site/theme/palettes.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { Palette } from "@material-ui/core/styles/createPalette"
44
*/
55
declare module "@material-ui/core/styles/createPalette" {
66
interface Palette {
7+
codeBlock: {
8+
// Text color for codeblocks
9+
contrastText: string
10+
// Background color for codeblocks
11+
main: string
12+
}
713
navbar: {
814
main: string
915
}
@@ -17,6 +23,10 @@ declare module "@material-ui/core/styles/createPalette" {
1723
}
1824

1925
interface PaletteOptions {
26+
codeBlock: {
27+
contrastText: string
28+
main: string
29+
}
2030
navbar: {
2131
main: string
2232
}
@@ -32,7 +42,18 @@ declare module "@material-ui/core/styles/createPalette" {
3242
*/
3343
export type CustomPalette = Pick<
3444
Palette,
35-
"action" | "background" | "divider" | "error" | "hero" | "info" | "navbar" | "primary" | "secondary" | "text" | "type"
45+
| "action"
46+
| "background"
47+
| "codeBlock"
48+
| "divider"
49+
| "error"
50+
| "hero"
51+
| "info"
52+
| "navbar"
53+
| "primary"
54+
| "secondary"
55+
| "text"
56+
| "type"
3657
>
3758

3859
/**
@@ -47,7 +68,10 @@ export const lightPalette: CustomPalette = {
4768
default: "#F3F3F3",
4869
paper: "#FFF",
4970
},
50-
71+
codeBlock: {
72+
main: "#F3F3F3",
73+
contrastText: "rgba(0, 0, 0, 0.9)",
74+
},
5175
primary: {
5276
main: "#519A54",
5377
light: "#A2E0A5",
@@ -108,6 +132,10 @@ export const darkPalette: CustomPalette = {
108132
secondary: lightPalette.secondary,
109133
info: lightPalette.info,
110134
error: lightPalette.error,
135+
codeBlock: {
136+
main: "rgb(24, 26, 27)",
137+
contrastText: "rgba(255, 255, 255, 0.8)",
138+
},
111139
hero: {
112140
main: "#141414",
113141
button: "#333333",

0 commit comments

Comments
 (0)