-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Selectable DCA frequency unit via dropdown
- Loading branch information
Showing
12 changed files
with
245 additions
and
37 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
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,41 @@ | ||
.tooltip { | ||
display: none; | ||
width: max-content; | ||
min-width: 120px; | ||
text-align: left; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
background: var(--hex-dark-blue-700); | ||
border: 1px solid var(--hex-dark-blue-400); | ||
color: white; | ||
padding: 10px; | ||
border-radius: 8px; | ||
z-index: 1000; | ||
box-shadow: 0px 40px 40px 0px rgba(0, 0, 0, 0.8); | ||
} | ||
|
||
.tooltip.show { | ||
display: block; | ||
} | ||
|
||
.tooltip > button { | ||
display: block; | ||
width: 100%; | ||
text-align: left; | ||
border: none; | ||
padding: 4px 8px; | ||
background: transparent; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
color: var(--hex-basic-500); | ||
} | ||
|
||
.tooltip > button.active { | ||
background: rgba(255, 255, 255, 0.06); | ||
color: white; | ||
} | ||
|
||
.tooltip > button:hover { | ||
color: white; | ||
} |
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,47 @@ | ||
import { html } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
import { UIGCElement } from 'component/base/UIGCElement'; | ||
|
||
import { Popper } from 'component/Popper'; | ||
|
||
import styles from './Dropdown.css'; | ||
|
||
type ItemProps = { | ||
text: string; | ||
active?: boolean; | ||
onClick: () => void; | ||
}; | ||
|
||
@customElement('uigc-dropdown') | ||
export class Dropdown extends Popper { | ||
static styles = [UIGCElement.styles, styles]; | ||
|
||
get buttonElement() { | ||
return this.shadowRoot.querySelector('.tooltip > button'); | ||
} | ||
|
||
@property({ type: String }) text = null; | ||
@property({ type: Array }) items: ItemProps[] = []; | ||
|
||
handleItemClick(item: ItemProps) { | ||
this.tooltipElement.classList.remove('show'); | ||
item.onClick(); | ||
} | ||
|
||
render() { | ||
return html` | ||
<slot></slot> | ||
<div class="tooltip"> | ||
${this.items.map( | ||
(item) => html` | ||
<button | ||
class=${item.active ? 'active' : ''} | ||
@click=${() => this.handleItemClick(item)}> | ||
${item.text} | ||
</button> | ||
`, | ||
)} | ||
</div> | ||
`; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -13,3 +13,7 @@ | |
font-size: 90%; | ||
z-index: 1000; | ||
} | ||
|
||
.tooltip.show { | ||
display: block; | ||
} |
Oops, something went wrong.