-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathindex.js
139 lines (126 loc) · 3.14 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import 'unfetch/polyfill'
import React from 'react'
import styled from '@emotion/styled'
import { storiesOf } from '@storybook/react'
import withMicrolinkHover from '../src'
const setData = () => ({
title: 'Browser as API',
description:
'Turns websites into data: Enter a URL, receive information. Make any URL embeddable. Capture any website as a snapshot. Generate PDF from any website. Automate web performance.',
lang: 'en',
author: null,
publisher: 'Microlink',
image: {
url: 'https://cdn.microlink.io/www/home.png',
type: 'png',
size: 97629,
height: 882,
width: 1686,
size_pretty: '97.6 kB'
},
url: 'https://microlink.io',
date: '2020-05-07T15:10:41.692Z',
logo: {
url: 'https://cdn.microlink.io/logo/trim.png',
type: 'png',
size: 5050,
height: 500,
width: 500,
size_pretty: '5.05 kB'
}
})
const Paraph = styled.div`
font-size: 16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial,
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
`
const Center = styled.div`
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
`
const Link = styled.a`
text-decoration: none;
color: rgb(6, 125, 247);
`
const Button = styled.button`
cursor: pointer;
text-decoration: none;
background: rgb(6, 125, 247);
color: white;
border: 0;
padding: 0.25rem 0.5rem;
border-radius: 12px;
`
storiesOf('decorator', module)
.add('as link', () => {
const MicrolinkHoverLink = withMicrolinkHover(Link)
return (
<Center>
<Paraph>
Check my{' '}
<MicrolinkHoverLink href='https://microlink.io' setData={setData}>
link
</MicrolinkHoverLink>
</Paraph>
</Center>
)
})
.add('as button', () => {
const MicrolinkHoverButton = withMicrolinkHover(Button)
return (
<Center>
<Paraph>
Check my{' '}
<MicrolinkHoverButton href='https://microlink.io' setData={setData}>
button
</MicrolinkHoverButton>
</Paraph>
</Center>
)
})
.add('as element', () => {
const MicrolinkHoverText = withMicrolinkHover(
styled(Paraph)`
color: gray;
`
)
return (
<Center>
<Paraph>
Check my{' '}
<MicrolinkHoverText url='https://microlink.io' setData={setData}>
word
</MicrolinkHoverText>
</Paraph>
</Center>
)
})
.add('custom style', () => {
const MicrolinkHoverLink = withMicrolinkHover(Link)
const CustomCenter = styled(Center)`
--microlink-border-color: #666;
--microlink-hover-border-color: #999;
color: white;
background: #1a1a1a;
`
return (
<CustomCenter>
<Paraph>
Check my{' '}
<MicrolinkHoverLink
style={{
background: '#1A1A1A',
color: 'white',
fontWeight: 'bold'
}}
href='https://microlink.io'
setData={setData}
>
link
</MicrolinkHoverLink>
</Paraph>
</CustomCenter>
)
})