Skip to content

Addon tabs component #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/components/addon-tabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Component from '@ember/component';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should definitely be in the style guide addon.


export default Component.extend({
currentTab: 0,
tagName: '',
});
7 changes: 7 additions & 0 deletions app/helpers/eq.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { helper } from '@ember/component/helper';

export function eq(params) {
return params[0] === params[1];
}

export default helper(eq);
1 change: 1 addition & 0 deletions app/styles/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "components/addon-tabs.css";
@import "components/brand-logos.css";
@import "components/faqs.css";
@import "components/homepage-image-grid.css";
Expand Down
51 changes: 51 additions & 0 deletions app/styles/components/addon-tabs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.addon-tabs {
background: linear-gradient(0deg, rgba(52,55,62,1) 0%, rgba(66,69,77,1) 100%);
background: rgb(52,55,62);
border-radius: 15px;
box-shadow: 0px 5px 15px -10px rgba(0,0,0,0.75);
width: 100%;
}

.addon-tabs--header {
display: flex;
text-align: left;
}

.addon-tabs--tab {
background: none;
border-color: #54565E;
border-width: 1px;
color: var(--color-gray-300);
height: 50px;
margin: 0;
margin-left: -1px;
padding: 0 10px;
text-align: left;
}

.addon-tabs--tab.active-tab {
background-color: var(--color-button-bg);
color: var(--color-button-text);
}

.addon-tabs--tab:first-child {
border-top-left-radius: 15px;
margin-left: 0;
}
.addon-tabs--tab:last-child {
border-top-right-radius: 15px;
flex-grow: 1;
}
.addon-tabs--content {
display: none;
padding: 30px;
text-align: left;
}
.addon-tabs--content.active-tab {
display: block;
}
.addon-tabs--code {
color: var(--color-gray-400);
font-size: .8em;
font-style: var(--font-family-mono);
}
81 changes: 81 additions & 0 deletions app/templates/components/addon-tabs.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<div class="addon-tabs">
<div class="addon-tabs--header" role="tablist">
<AddonTabs::Tab
@currentTab={{this.currentTab}}
@tabId={{0}}
@onClick={{action (mut this.currentTab) 0}}
>
ember-cli-sass
</AddonTabs::Tab>
<AddonTabs::Tab
@currentTab={{this.currentTab}}
@tabId={{1}}
@onClick={{action (mut this.currentTab) 1}}
>
SVG jar
</AddonTabs::Tab>
<AddonTabs::Tab
@currentTab={{this.currentTab}}
@tabId={{2}}
@onClick={{action (mut this.currentTab) 2}}
>
Percy
</AddonTabs::Tab>
<AddonTabs::Tab
@currentTab={{this.currentTab}}
@tabId={{3}}
@onClick={{action (mut this.currentTab) 3}}
>
ember-cli-deploy
</AddonTabs::Tab>
</div>

{{!-- template-lint-disable block-indentation --}}
<AddonTabs::Panel
@currentTab={{this.currentTab}}
@tabId={{0}}
>
<p>Ember CLI Sass wires up your app with Sass, in a single command.</p>

<code class="addon-tabs--code">
<pre class="mt-3">&gt; ember install ember-cli-sass

// app.scss
body {
@extend .font-serif;
}</pre>
</code>
</AddonTabs::Panel>

<AddonTabs::Panel
@currentTab={{this.currentTab}}
@tabId={{1}}
>
<p>TODO one</p>

<code class="addon-tabs--code">
<pre class="mt-3"></pre>
</code>
</AddonTabs::Panel>
<AddonTabs::Panel
@currentTab={{this.currentTab}}
@tabId={{2}}
>
<p>TODO two</p>

<code class="addon-tabs--code">
<pre class="mt-3"></pre>
</code>
</AddonTabs::Panel>
<AddonTabs::Panel
@currentTab={{this.currentTab}}
@tabId={{3}}
>
<p>TODO three</p>

<code class="addon-tabs--code">
<pre class="mt-3"></pre>
</code>
</AddonTabs::Panel>
{{!-- template-lint-enable block-indentation --}}
</div>
9 changes: 9 additions & 0 deletions app/templates/components/addon-tabs/panel.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div
id="addon-panel-{{@tabId}}"
role="tabpanel"
tabindex="0"
aria-labelledby="addon-tab-{{@tabId}}"
class="addon-tabs--content {{if (eq @currentTab @tabId) "active-tab"}}"
>
{{yield}}
</div>
11 changes: 11 additions & 0 deletions app/templates/components/addon-tabs/tab.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<button
class="addon-tabs--tab {{if (eq @currentTab @tabId) "active-tab"}}"
role="tab"
aria-selected={{if (eq @currentTab @tabId) "true"}}
aria-controls="addon-panel-{{@tabId}}"
id="addon-tab-{{@tabId}}"
tabindex={{if (eq @currentTab @tabId) "0" "-1"}}
onclick={{@onClick}}
>
{{yield}}
</button>
2 changes: 1 addition & 1 deletion app/templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
</div>

<div class="lg:col-3 text-center">
<img src="/images/addons.svg" alt="ember addons">
<AddonTabs />
</div>

<div class="lg:col-3">
Expand Down
64 changes: 0 additions & 64 deletions public/images/addons.svg

This file was deleted.