8000 feat: Add copy button to the SSH Page by BrunoQuaresma · Pull Request #1962 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: Add copy button to the SSH Page #1962

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

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions site/src/components/CodeExample/CodeExample.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ export const Example = Template.bind({})
Example.args = {
code: sampleCode,
}

export const LongCode = Template.bind({})
LongCode.args = {
code: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICnKzATuWwmmt5+CKTPuRGN0R1PBemA+6/SStpLiyX+L",
}
8 changes: 7 additions & 1 deletion site/src/components/CodeExample/CodeExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const useStyles = makeStyles((theme) => ({
root: {
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
background: theme.palette.background.default,
color: theme.palette.primary.contrastText,
Expand All @@ -39,6 +38,13 @@ const useStyles = makeStyles((theme) => ({
},
code: {
padding: `${theme.spacing(0.5)}px ${theme.spacing(0.75)}px ${theme.spacing(0.5)}px ${theme.spacing(2)}px`,
whiteSpace: "nowrap",
width: "100%",
overflowX: "auto",
// Have a better area to display the scrollbar
height: 42,
display: "flex",
alignItems: "center",
},
button: {
border: 0,
Expand Down
6 changes: 3 additions & 3 deletions site/src/pages/UserSettingsPage/SSHKeysPage/SSHKeysPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Button from "@material-ui/core/Button"
import CircularProgress from "@material-ui/core/CircularProgress"
import { useActor } from "@xstate/react"
import React, { useContext, useEffect } from "react"
import { CodeBlock } from "../../../components/CodeBlock/CodeBlock"
import { CodeExample } from "../../../components/CodeExample/CodeExample"
import { ConfirmDialog } from "../../../components/ConfirmDialog/ConfirmDialog"
import { Section } from "../../../components/Section/Section"
import { Stack } from "../../../components/Stack/Stack"
Expand Down Expand Up @@ -41,10 +41,10 @@ export const SSHKeysPage: React.FC = () => {

{sshKey && (
<Stack>
<CodeBlock lines={[sshKey.public_key.trim()]} />
<CodeExample code={sshKey.public_key.trim()} />
<div>
<Button
color="primary"
variant="outlined"
onClick={() => {
authSend({ type: "REGENERATE_SSH_KEY" })
}}
Expand Down
0