Skip to content

Commit c8b966e

Browse files
timothyisMatthew Sweeney
authored andcommitted
Add deploy banner (#1438)
* Add deploy banner to guides * Extra work * Remove duplicate noreferrer * Fix links * Fix link imports * Fix errors * Improve deploy banner * Fix cards * Fix note font-size * Fix spacing * Hint -> Note
1 parent 5ed8f87 commit c8b966e

File tree

143 files changed

+1176
-1340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+1176
-1340
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ To make the creation of documentation and guides as simple as possible, we have
211211

212212
You can find multiple examples in each page of how to import and use these components, below is an example import statement:
213213

214-
`import { GenericLink } from '~/components/text/link'`
214+
`import Link from '~/components/text/link'`
215215

216216
We believe that these components should be enough to cover usage in nearly all situations, however, if you feel that a new component should be added then please do so in a separate pull request, stating clearly your reasons for adding it.
217217

components/api/section.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import HR from '~/components/text/hr'
77
import { UL, LI } from '../text/list'
88
import { H1, H2, H3, H4, P } from '../text'
99
import { InlineCode, Code } from '../text/code'
10-
import { GenericLink } from '../text/link'
10+
import Link from '../text/link'
1111

1212
class DocH2 extends React.PureComponent {
1313
render() {
@@ -87,7 +87,7 @@ export const components = {
8787
h4: DocH4,
8888
code: Code,
8989
inlineCode: InlineCode,
90-
a: GenericLink,
90+
a: Link,
9191
blockquote: Quote,
9292
hr: HR
9393
}

components/buttons/deploy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Button from './button'
44
export default function DeployButton({ url }) {
55
return (
66
<div className="deploy-button">
7-
<a href={url}>
7+
<a href={url} target="_blank" rel="noopener">
88
<Button type="success" icon={<Logo height={16} width={16} />}>
99
Deploy
1010
</Button>
@@ -16,6 +16,7 @@ export default function DeployButton({ url }) {
1616
1717
.deploy-button :global(.button) {
1818
padding: 0;
19+
min-width: 124px;
1920
}
2021
2122
.deploy-button :global(.button:hover) {

components/card/card.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cn from 'classnames'
22
import { Component } from 'react'
3-
import { GenericLink } from '~/components/text/link'
3+
import NextLink from 'next/link'
44
import Text, { H4 } from '~/components/text'
55

66
export default class Card extends Component {
@@ -9,10 +9,12 @@ export default class Card extends Component {
99

1010
return (
1111
<div className={cn('card', className)} {...props}>
12-
<GenericLink href={href} as={as}>
13-
{title && <H4>{title}</H4>}
14-
<Text small>{children}</Text>
15-
</GenericLink>
12+
<NextLink href={href} as={as}>
13+
<a>
14+
{title && <H4>{title}</H4>}
15+
<Text small>{children}</Text>
16+
</a>
17+
</NextLink>
1618

1719
<style jsx>{`
1820
.card {

components/deploy-banner/index.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import Note from '~/components/text/note'
2+
import { DeployButton } from '~/components/buttons'
3+
import Link from '~/components/text/link'
4+
5+
export default function DeployBanner({ example, demo }) {
6+
const deployUrl = example.includes('github.com/zeit/now-examples')
7+
? `https://zeit.co/new/project?template=${example}`
8+
: `https://zeit.co/new/${example}`
9+
10+
return (
11+
<div className="deploy-banner">
12+
<Note label={false}>
13+
<span>
14+
Live demo:{' '}
15+
<Link color href={demo}>
16+
{demo}
17+
</Link>
18+
</span>
19+
<DeployButton url={deployUrl} />
20+
</Note>
21+
<style jsx>{`
22+
.deploy-banner {
23+
margin-bottom: 32px;
24+
}
25+
26+
.deploy-banner :global(.note) {
27+
display: flex;
28+
width: 100%;
29+
align-items: center;
30+
justify-content: space-between;
31+
font-size: 16px;
32+
padding-top: 8px;
33+
padding-bottom: 8px;
34+
}
35+
36+
@media screen and (max-width: 600px) {
37+
.deploy-banner :global(.note) {
38+
flex-direction: column;
39+
align-items: flex-start;
40+
padding-top: 16px;
41+
padding-bottom: 20px;
42+
}
43+
44+
.deploy-banner span {
45+
margin-bottom: 16px;
46+
}
47+
}
48+
`}</style>
49+
</div>
50+
)
51+
}

components/docs/case-study-card.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { memo } from 'react'
2-
import { AnchorLink } from '~/components/text/link'
2+
import Link from '~/components/text/link'
33
import { P } from '~/components/text'
44

55
function CaseStudyCard({ icon, description }) {
@@ -8,7 +8,7 @@ function CaseStudyCard({ icon, description }) {
88
<div className="case-study-card-container">
99
<Icon />
1010
<P>{description}</P>
11-
<AnchorLink>Read case study</AnchorLink>
11+
<Link href="#">Read case study</Link>
1212
<style jsx>{`
1313
.case-study-card-container {
1414
display: flex;

components/footer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { memo } from 'react'
2-
import Link from 'next/link'
2+
import Link from '~/components/text/link'
33

44
// Components
55
import FullLogo from '../logos/full'

components/icons/external-link.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
import PropTypes from 'prop-types'
2-
import React from 'react'
1+
import withIcon from '~/lib/with-icon'
32

4-
const ExternalLink = (props, { darkBg = false }) => (
5-
<svg width="13" height="13" xmlns="http://www.w3.org/2000/svg">
6-
<g stroke={darkBg ? '#fff' : '#000'} fill="none" fillRule="evenodd">
7-
<path d="M6.2 6.7l5-5.3" strokeLinecap="square" />
8-
<g strokeLinecap="square">
9-
<path d="M7.9.9h4M11.9.9v4" />
10-
</g>
11-
<path d="M9.9 7.4v2.5a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-5c0-1.1.9-2 2-2h2.5" />
12-
</g>
13-
</svg>
14-
)
3+
const ExternalLink = `<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/><path d="M15 3h6v6"/><path d="M10 14L21 3"/>`
154

16-
ExternalLink.contextTypes = {
17-
darkBg: PropTypes.bool
18-
}
19-
20-
export default ExternalLink
5+
export default withIcon(ExternalLink)

components/icons/link.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import withIcon from '~/lib/with-icon'
2+
3+
const Link = `<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>`
4+
5+
export default withIcon(Link)

components/layout/content-footer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { GenericLink } from '~/components/text/link'
1+
import Link from '~/components/text/link'
22
import formatDate from 'date-fns/format'
33

44
const ContentFooter = ({ lastEdited, editUrl }) => (
55
<footer>
66
<span>Last Edited on {formatDate(lastEdited, 'MMMM Do YYYY')}</span>
7-
<GenericLink href={`https://github.com/zeit/docs/edit/master/${editUrl}`}>
7+
<Link href={`https://github.com/zeit/docs/edit/master/${editUrl}`}>
88
Edit This Page on GitHub
9-
</GenericLink>
9+
</Link>
1010

1111
<style jsx>{`
1212
footer {

0 commit comments

Comments
 (0)