Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9206682
commit 870eb1b
Showing
9 changed files
with
212 additions
and
14 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import './reset.less'; | ||
import './App.less'; | ||
|
||
class Thing { | ||
constructor() { | ||
console.log('thing created', this); | ||
} | ||
} | ||
import { Nav } from './Nav'; | ||
|
||
import './App.less'; | ||
|
||
const a = new Thing(); | ||
new Nav($('.Nav')); |
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,93 @@ | ||
@import (reference) './definitions.less'; | ||
|
||
.Nav { | ||
position: fixed; | ||
top: 50px; | ||
left: 50px; | ||
background: fade(black, 50%); | ||
padding: 14px 30px; | ||
color: @colorWhite; | ||
|
||
ul { | ||
transition: opacity .2s ease, max-height .2s ease; | ||
max-height: 150px; | ||
} | ||
li { | ||
&:before { | ||
content: '> '; | ||
} | ||
} | ||
li + li { | ||
margin-top: @gutterSmall; | ||
} | ||
label { | ||
cursor: pointer; | ||
margin-right: 1em; | ||
} | ||
input[type=radio] { | ||
display: none; | ||
} | ||
&-text { | ||
|
||
} | ||
input:checked + &-text { | ||
font-weight: bold; | ||
|
||
&:after { | ||
content: ' <'; | ||
position: absolute; | ||
margin-left: .5em; | ||
pointer-events: none; | ||
} | ||
} | ||
|
||
/* top/bottom bars */ | ||
&:before, | ||
&:after { | ||
content: ''; | ||
position: absolute; | ||
height: 10px; | ||
left: -2px; | ||
right: -2px; | ||
border: 2px solid white; | ||
} | ||
&:before { | ||
top: -2px; | ||
border-bottom: none; | ||
} | ||
&:after { | ||
bottom: -2px; | ||
border-top: none; | ||
} | ||
|
||
/* open/close */ | ||
&-toggle { | ||
position: absolute; | ||
top: 5px; | ||
right: 5px; | ||
width: 15px; | ||
height: 15px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border: 1px solid @colorWhite; | ||
background: none; | ||
color: @colorWhite; | ||
font-size: 16px; | ||
cursor: pointer; | ||
} | ||
&-toggleContent:before { | ||
content: '-'; | ||
} | ||
|
||
/* collapsed */ | ||
&--collapsed { | ||
ul { | ||
max-height: 0; | ||
opacity: 0; | ||
} | ||
} | ||
&--collapsed &-toggleContent:before { | ||
content: '+'; | ||
} | ||
} |
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,16 @@ | ||
import './Nav.less'; | ||
|
||
export class Nav { | ||
constructor(private element: JQuery) { | ||
// on change | ||
element.find('input[type=radio]').on('change', e => { | ||
const input = e.currentTarget as HTMLInputElement; | ||
window.location.hash = input.value; | ||
}); | ||
|
||
// toggle | ||
element.find('.Nav-toggle').click(e => { | ||
element.toggleClass('Nav--collapsed'); | ||
}); | ||
} | ||
} |
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,3 @@ | ||
@colorWhite: white; | ||
@gutter: 16px; | ||
@gutterSmall: 8px; |
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 @@ | ||
declare var $: JQueryStatic; |
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
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 |
---|---|---|
|
@@ -10,5 +10,8 @@ | |
}, | ||
"exclude": [ | ||
"node_modules" | ||
], | ||
"files": [ | ||
"index.d.ts" | ||
] | ||
} |