-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1614 from mkszepp/drop-outdated-dev-dependencies
Drop outdated devDependencies
- Loading branch information
Showing
6 changed files
with
620 additions
and
22,685 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class CodeExampleComponent extends Component { | ||
showResult = true; | ||
@tracked _activeTab = undefined; | ||
|
||
get activeTab() { | ||
return this._activeTab || (this.showResult ? 'result' : 'js'); | ||
} | ||
|
||
get partialName() { | ||
return `snippets/${this.args.hbs.replace('.hbs', '')}`; | ||
} | ||
|
||
@action | ||
setActiveTab(value) { | ||
this._activeTab = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Docs | ||
.code-example { | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.code-example-tabs { | ||
display: flex; | ||
} | ||
.code-example-tab { | ||
padding: 0.2rem 0.5rem; | ||
background-color: white; | ||
text-transform: capitalize; | ||
&:not(.active) { | ||
color: #999; | ||
cursor: pointer; | ||
} | ||
&.active { | ||
cursor: normal; | ||
} | ||
} | ||
.code-example-snippet { | ||
margin-bottom: 0; | ||
background-color: #f9f9f9; | ||
padding: 1rem; | ||
&:not(.active) { | ||
display: none; | ||
} | ||
} | ||
|
||
@mixin ember-code-example($color) { | ||
.code-example-tab.active { | ||
border-bottom: 2px solid $color; | ||
color: $color; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<article class="code-example" ...attributes> | ||
<nav class="code-example-tabs"> | ||
{{#if @hbs}} | ||
<div class="code-example-tab {{if (eq this.activeTab "hbs") 'active'}}" role="button" {{on "click" (fn this.setActiveTab "hbs")}}>Template</div> | ||
{{/if}} | ||
{{#if @hbs2}} | ||
<div class="code-example-tab {{if (eq this.activeTab "hbs2") 'active'}}" role="button" {{on "click" (fn this.setActiveTab "hbs2")}}>Template 2</div> | ||
{{/if}} | ||
{{#if @js}} | ||
<div class="code-example-tab {{if (eq this.activeTab "js") 'active'}}" role="button" {{on "click" (fn this.setActiveTab "js")}}>Javascript</div> | ||
{{/if}} | ||
{{#if @css}} | ||
<div class="code-example-tab {{if (eq this.activeTab "css") 'active'}}" role="button" {{on "click" (fn this.setActiveTab "css")}}>CSS</div> | ||
{{/if}} | ||
{{#if this.showResult}} | ||
<div class="code-example-tab {{if (eq this.activeTab "result") 'active'}}" role="button" {{on "click" (fn this.setActiveTab "result")}}>Result</div> | ||
{{/if}} | ||
</nav> | ||
{{#if (and @hbs (eq this.activeTab 'hbs'))}} | ||
{{#let (get-code-snippet @hbs) as |snippet|}} | ||
<CodeBlock @language="markup" @code={{snippet.source}} /> | ||
{{/let}} | ||
{{/if}} | ||
{{#if @hbs2}} | ||
{{#let (get-code-snippet @hbs2) as |snippet|}} | ||
<CodeBlock @language="markup" @code={{snippet.source}} /> | ||
{{/let}} | ||
{{/if}} | ||
{{#if (and @js (eq this.activeTab 'js'))}} | ||
{{#let (get-code-snippet @js) as |snippet|}} | ||
<CodeBlock @language={{snippet.language}} @code={{snippet.source}} /> | ||
{{/let}} | ||
{{/if}} | ||
{{#if (and @css (eq this.activeTab 'css'))}} | ||
{{#let (get-code-snippet @css) as |snippet|}} | ||
<CodeBlock @language={{snippet.language}} @code={{snippet.source}} /> | ||
{{/let}} | ||
{{/if}} | ||
{{#if (and this.showResult (has-block))}} | ||
<div class="code-example-snippet result {{if (eq this.activeTab 'result') 'active'}}"> | ||
{{yield this.partialName}} | ||
</div> | ||
{{/if}} | ||
</article> |