-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
9 changed files
with
72 additions
and
32 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
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,7 @@ | ||
import View from "./index"; | ||
import { EventsDomainConfig } from "../models/config"; | ||
export default class Label implements View { | ||
private domain; | ||
constructor(domain: EventsDomainConfig); | ||
render(): HTMLDivElement; | ||
} |
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
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 @@ | ||
export default abstract class View { | ||
abstract render(): HTMLElement | HTMLElement[] | ||
} |
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,36 @@ | ||
import View from "./index" | ||
import createElement from '../utils/create-element' | ||
import { EventsDomainConfig } from "../models/config"; | ||
|
||
export default class Label implements View { | ||
constructor(private domain: EventsDomainConfig) {} | ||
|
||
render() { | ||
const wrapper: HTMLDivElement = createElement('div', 'events-label-wrapper', | ||
[ | ||
'border-top: 1px solid #CCC', | ||
'position: absolute', | ||
'width: 100%', | ||
], | ||
[ | ||
`top: ${this.domain.topOffsetRatio * 100}%` | ||
] | ||
) | ||
|
||
const eventsLabel: HTMLDivElement = createElement('div', 'events-label', [ | ||
'background: white', | ||
'border-bottom-right-radius: 4px', | ||
'box-shadow: 1px 2px 4px #AAA', | ||
'display: inline-block', | ||
'color: #444', | ||
'font-size: .8em', | ||
'font-family: sans-serif', | ||
'padding: 4px 8px', | ||
]) | ||
eventsLabel.innerText = this.domain.label | ||
|
||
wrapper.appendChild(eventsLabel) | ||
|
||
return wrapper | ||
} | ||
} |