-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
198 lines (190 loc) · 7.31 KB
/
index.html
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Embedding Items with Square Market</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, minimal-ui" />
<link href="https://d2dyi2pd86a6cw.cloudfront.net/market/assets/base.css" rel="stylesheet" media="screen">
<style>
h1 {
margin-bottom: 5px;
}
code {
font-family: inherit;
font-weight: 400;
}
pre {
overflow: auto;
}
p {
color: #959ba2;
line-height: 22px;
margin-bottom: 13px;
}
figcaption code,
p code {
color: #00b386;
}
figcaption p {
font-size: 12px;
line-height: 20px;
}
.wrapper {
padding: 34px 0 36px;
}
.footer {
background: white;
border: none;
min-height: 0 !important;
padding: 5px 0 45px;
}
.footer a {
display: inline-block;
}
.footer-copyright:before {
content: none;
display: none;
}
.example-section {
position: relative;
}
.example-section:last-of-type p:last-of-type {
margin-bottom: 2px;
}
.example-section::before {
border-top: 1px solid #eff0f1;
content: "";
display: block;
margin: 23px -5px 0;
padding-bottom: 5px;
position: relative;
}
.example-header {
margin: 20px 0 10px;
}
.example-embed {
margin-bottom: 28px;
}
.example-embed-container {
max-width: 558px;
}
.example-embed-list {
letter-spacing: -.3em;
}
.example-embed-list li {
display: inline-block;
letter-spacing: normal;
width: 100%;
}
.example-embed-list li:nth-child(odd) {
margin-right: 10px;
}
.small {
max-width: 200px;
}
.smaller {
max-width: 180px;
}
@media screen and (max-width: 599px) {
.example-embed-list li:nth-child(odd) {
margin-right: 0;
}
}
@media screen and (min-width: 600px) and (max-width: 767px) {
.example-embed-list li {
width: 281px;
}
}
@media screen and (min-width: 768px) and (max-width: 1023px) {
.example-embed-list li {
width: 350px;
}
}
@media screen and (min-width: 1024px) {
.example-embed-list li {
width: 282px;
margin-right: 10px;
}
.example-embed-list li:nth-child(3n) {
margin-right: 0;
}
}
</style>
</head>
<body>
<div class="wrapper container">
<h1>Embedding Items with Square Market</h1>
<p>This site contains examples for embedding Square Market items in your own website. Please refer to the <a href="https://github.com/square/square-market-embeds">README</a> for full documentation.</p>
<div class="example-section">
<h3 class="example-header">Sizes</h3>
<p>An embedded item can be between 200px and 558px wide, depending on the size of its container.</p>
<p>If its container is <strong>static</strong> (i.e. has a fixed width) and smaller is than 558px wide, the item will take up the entire width of the container. If the container is <strong>fluid</strong> (i.e. has a percentage width), the item will contract/expand with the size of the container. The embedded item appears centered in a container wider than 558px. Resize the window to see how it affects the examples below.</p>
<figure class="example-embed">
<figcaption>
<p><strong>Example</strong>: The embedded item is in a fixed-size container with <code>max-width: 200px</code>.</p>
</figcaption>
<div class="example-embed-container small">
<a href="https://squareup.com/market/upper-metal-class/bar-earrings" class="sq-embed-item">Bar Earrings from Upper Metal Class on Square Market</a>
</div>
</figure>
<figure class="example-embed">
<figcaption>
<p><strong>Example</strong>: The embedded item is in a fixed-size container with <code>max-width: 180px</code>. Because the container is smaller than the minimum width, the item remains 200px wide.</p>
</figcaption>
<div class="example-embed-container smaller">
<a href="https://squareup.com/market/upper-metal-class/bar-earrings" class="sq-embed-item">Bar Earrings from Upper Metal Class on Square Market</a>
</div>
</figure>
<figure class="example-embed">
<figcaption>
<p><strong>Example</strong>: The embedded item is in a fixed-size container with <code>max-width: 558px</code>. It resizes based on this layout's responsive breakpoints.</p>
</figcaption>
<div class="example-embed-container">
<a href="https://squareup.com/market/upper-metal-class/bar-earrings" class="sq-embed-item">Bar Earrings from Upper Metal Class on Square Market</a>
</div>
</figure>
</div>
<div class="example-section">
<h3 class="example-header">Multiple Items</h3>
<p>You might want to embed more than one item at a time; say, in a list or gallery. The item styling should be flexible enough to support any orientation you choose. See below for a few common examples or jump straight to the <a href="example-masonry/index.html">Masonry test</a>.</p>
<figure class="example-embed">
<figcaption>
<p><strong>Example</strong>: The embedded items are in a responsive list. They will automatically adjust to the dimensions of their container.</p>
</figcaption>
<ul class="example-embed-list">
<li><a href="https://squareup.com/market/upper-metal-class/bar-earrings" class="sq-embed-item">Bar Earrings from Upper Metal Class on Square Market</a></li>
<li><a href="https://squareup.com/market/upper-metal-class/diamonds" class="sq-embed-item">Diamonds from Upper Metal Class on Square Market</a></li>
<li><a href="https://squareup.com/market/upper-metal-class/circle-earrings" class="sq-embed-item">Back to Basics - Circles from Upper Metal Class on Square Market</a></li>
</ul>
</figure>
</div>
<div class="example-section">
<h3 class="example-header">DRY</h3>
<p>If the script portion of the embed code is present on the page, any link to Square Market with the class <code>sq-item-embed</code> will be replaced with an embedded item. To reduce unnecessary duplication, you may only want to include the script tag once, but it won't slow down your page if you include it more than once.</p>
</div>
<div class="example-section">
<h3 class="example-header">Async</h3>
<p>As an alternative to using the embed script as-is, you can include the script tag using <code>appendChild</code> so that it doesn't block page rendering:</p>
<code><pre><script>
(function(d, id, src) {
var s = d.getElementById(id);
if (!s) {
s = d.createElement('script');
s.id = id;
s.src = src;
d.head.appendChild(s);
}
})(document, "sq-embed-js", "https://d2dyi2pd86a6cw.cloudfront.net/market/embed.js");
</script>
</pre></code>
<p>You may see the original link tags render for a moment before the script loads.</p>
</div>
</div>
<footer class="footer">
<a href="https://squareup.com/market/">
<i class="icon-footer-jewel"></i>
</a>
</footer>
<script src="https://d2dyi2pd86a6cw.cloudfront.net/market/embed.js" id="sq-embed-js" charset="utf-8"></script>
</body>
</html>