Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,010 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
.layouts/src/gatsby-theme-primer-wiki/components/clipboard-copy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Button, StyledOcticon } from "@primer/components"; | ||
import { CheckIcon, CopyIcon } from "@primer/octicons-react"; | ||
import copy from "copy-to-clipboard"; | ||
import React from "react"; | ||
|
||
function ClipboardCopy({ value }) { | ||
const [copied, setCopied] = React.useState(false); | ||
|
||
React.useEffect(() => { | ||
const timeout = setTimeout(() => { | ||
if (copied) setCopied(false); | ||
}, 1000); | ||
|
||
return () => clearTimeout(timeout); | ||
}, [copied]); | ||
|
||
return ( | ||
<Button | ||
px={2} | ||
aria-label="Copy to clipboard" | ||
onClick={() => { | ||
copy(value); | ||
setCopied(true); | ||
}} | ||
backgroundColor="bg.primary" | ||
sx={{ | ||
":hover": { | ||
backgroundColor: "bg.alt", | ||
}, | ||
}} | ||
> | ||
{copied ? ( | ||
<StyledOcticon icon={CheckIcon} color="text.link" /> | ||
) : ( | ||
<StyledOcticon icon={CopyIcon} color="text.placeholder" /> | ||
)} | ||
</Button> | ||
); | ||
} | ||
|
||
export default ClipboardCopy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 14 additions & 5 deletions
19
.layouts/src/gatsby-theme-primer-wiki/components/dark-button.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
import { ButtonOutline, themeGet } from '@primer/components' | ||
import styled from 'styled-components' | ||
import { ButtonOutline, themeGet } from "@primer/components"; | ||
import styled from "styled-components"; | ||
|
||
const DarkButton = styled(ButtonOutline)` | ||
color: ${themeGet('colors.header.text')}; | ||
color: ${themeGet("colors.header.text")}; | ||
background-color: transparent; | ||
box-shadow: none; | ||
` | ||
&:hover { | ||
background-color: hsl(31, 45%, 20%); | ||
} | ||
&:hover > div { | ||
color: #fff; | ||
} | ||
&:hover svg { | ||
fill: #fff; | ||
} | ||
`; | ||
|
||
export default DarkButton | ||
export default DarkButton; |
Oops, something went wrong.