Skip to content

Commit ed93287

Browse files
authored
Merge pull request #251 from ember-learn/redesign/wells
Image wells
2 parents e7a5215 + 04500eb commit ed93287

File tree

4 files changed

+124
-0
lines changed

4 files changed

+124
-0
lines changed

addon/styles/addon.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
@import 'layout.css';
1515
@import 'grid.css';
1616
@import 'icon.css';
17+
@import 'well.css';
1718
@import 'background-shapes.css';
1819

1920
/* Components */

addon/styles/global.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ strong {
149149
font-weight: var(--font-weight-3);
150150
}
151151

152+
figure,
153+
figcaption {
154+
display: block;
155+
margin: 0;
156+
padding: 0;
157+
}
158+
159+
figcaption {
160+
margin-top: var(--spacing-1);
161+
color: var(--color-gray-600);
162+
}
163+
152164
/*
153165
@media (max-width: 1280px) and (min-width: 421px) {
154166
body,

addon/styles/well.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.well {
2+
display: flex;
3+
height: 100%;
4+
box-sizing: border-box;
5+
background: var(--color-white);
6+
border-radius: var(--radius-lg);
7+
border: 2px solid var(--color-gray-200);
8+
overflow: hidden;
9+
}
10+
11+
a.well:focus {
12+
border-color: var(--color-white);
13+
}
14+
15+
a.well:hover {
16+
border-color: var(--color-gray-300);
17+
}
18+
19+
.well img {
20+
display: block;
21+
margin: auto;
22+
}
23+
24+
[class*='well-'] {
25+
position: relative;
26+
height: 0;
27+
}
28+
29+
.well-1\/1 {
30+
padding: 0 0 100%;
31+
}
32+
33+
.well-4\/3 {
34+
padding: 0 0 75%;
35+
}
36+
37+
.well-16\/9 {
38+
padding: 0 0 56.25%;
39+
}
40+
41+
[class*='well-'] img {
42+
position: absolute;
43+
top: 50%;
44+
left: 50%;
45+
max-width: calc(100% - 2 * var(--spacing-3));
46+
max-height: calc(100% - 2 * var(--spacing-3));
47+
transform: translate(-50%, -50%);
48+
}

docs/concepts/wells.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Wells
2+
3+
Wells provide a box to wrap images that should be presented on a background, most likely because they have transparency.
4+
5+
```html
6+
<!-- Note: p-2 and m-2 are spacer helpers and not relevant to the example -->
7+
<div class="well p-2 m-2">
8+
Hello World
9+
</div>
10+
```
11+
12+
They also come in multiple ratios and ensure that a contained image is resized to fill the space appropriatly.
13+
14+
```html
15+
<div class="layout">
16+
<div class="sm:col-2 lg:col-2 p-2">
17+
<h3>Ratio 1:1</h3>
18+
<div class="well well-1/1">
19+
<img src="/ember-logo.png" alt="Ember.js" />
20+
</div>
21+
</div>
22+
<div class="sm:col-2 lg:col-2 p-2">
23+
<h3>Ratio 4:3</h3>
24+
<div class="well well-4/3">
25+
<img src="/ember-logo.png" alt="Ember.js" />
26+
</div>
27+
</div>
28+
<div class="sm:col-2 lg:col-2 p-2">
29+
<h3>Ratio 16:9</h3>
30+
<div class="well well-16/9">
31+
<img src="/ember-logo.png" alt="Ember.js" />
32+
</div>
33+
</div>
34+
</div>
35+
```
36+
37+
Wells can be applied to anchors and work well with HTML `<figure>` elements.
38+
39+
```html
40+
<div class="layout">
41+
<div class="sm:col-2 lg:col-2 p-2">
42+
<figure>
43+
<div class="well well-16/9">
44+
<img src="/ember-logo.png" alt="Ember.js" />
45+
</div>
46+
<figcaption>
47+
A well thought out caption to add more information to the image above
48+
</figcaption>
49+
</figure>
50+
</div>
51+
<div class="sm:col-2 lg:col-2 p-2">
52+
<figure>
53+
<a href="#" class="well well-16/9">
54+
<img src="/ember-logo.png" alt="Ember.js" />
55+
</a>
56+
<figcaption>
57+
Using an anchor for the well works, too. You may want to add an additional link to the text
58+
and or make sure this becomes clear from the context.
59+
</figcaption>
60+
</figure>
61+
</div>
62+
</div>
63+
```

0 commit comments

Comments
 (0)