Skip to content

Commit 0af41b5

Browse files
MinThaMiemansona
authored andcommitted
Creates banner with the same style as on the current website
1 parent 48233d1 commit 0af41b5

File tree

6 files changed

+86
-0
lines changed

6 files changed

+86
-0
lines changed

addon/components/es-banner.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div
2+
class="es-banner"
3+
data-test-es-banner
4+
>
5+
{{yield}}
6+
</div>

addon/styles/addon.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
@import 'helpers/index.css';
2020

2121
/* Components */
22+
@import 'components/es-banner.css';
2223
@import 'components/es-button.css';
2324
@import 'components/es-card.css';
2425
@import 'components/es-footer.css';

addon/styles/components/es-banner.css

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.es-banner {
2+
position: relative;
3+
display: flex;
4+
justify-content: center;
5+
align-items: center;
6+
background-color: var(--color-brand-hc-dark);
7+
padding: 8px 8px 10px;
8+
color: var(--color-white);
9+
}
10+
11+
.es-banner a, .es-banner a:link, .es-banner a:visited {
12+
color: var(--color-white);
13+
text-decoration: none;
14+
border-bottom: 1px solid var(--color-white-40);
15+
background: none;
16+
font-size: 16px;
17+
line-height: 15px;
18+
}
19+
20+
.es-banner a:hover, .es-banner a:focus {
21+
border-bottom: 1px solid var(--color-white);
22+
}
23+
24+
.es-banner a + a {
25+
margin-left: 20px;
26+
position: relative;
27+
}
28+
29+
.es-banner a + a::before {
30+
content: '';
31+
width: 3px;
32+
height: 3px;
33+
background: var(--color-white);
34+
border-radius: 50%;
35+
top: 50%;
36+
transform: translateY(-50%) translateX(-50%);
37+
display: block;
38+
left: -10px;
39+
pointer-events: none;
40+
position: absolute;
41+
}

app/components/es-banner.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'ember-styleguide/components/es-banner';

docs/components/banner.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Banner
2+
3+
## Usage
4+
5+
A banner will be shown at the top of the page. That can be filled with text.
6+
```handlebars
7+
<EsBanner>Some content goes here</EsBanner>
8+
```
9+
The banner can also contain a link.
10+
```handlebars
11+
<EsBanner><a href="#">Visit Website</a></EsBanner>
12+
```
13+
14+
When you pass multiple links into the component they will be separated by a tiny dot.
15+
```handlebars
16+
<EsBanner><a href="#">Visit Website</a><a href="#">Visit Something else</a></EsBanner>
17+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
3+
import { render } from '@ember/test-helpers';
4+
import { hbs } from 'ember-cli-htmlbars';
5+
6+
module('Integration | Component | es-banner', function (hooks) {
7+
setupRenderingTest(hooks);
8+
9+
test('it renders', async function (assert) {
10+
await render(hbs`
11+
<EsBanner>
12+
I have an announcement to make
13+
</EsBanner>
14+
`);
15+
16+
assert
17+
.dom('[data-test-es-banner]')
18+
.hasText('I have an announcement to make', 'We see the correct message');
19+
});
20+
});

0 commit comments

Comments
 (0)