generated from garrettmills/template-npm-typescript
parent
cf1f436b3c
commit
00fa0067aa
@ -1,7 +1,6 @@
|
||||
import 'bootstrap'
|
||||
import 'bootstrap/dist/css/bootstrap.min.css'
|
||||
|
||||
import './resources/theme.css'
|
||||
export * from './Test.component.js'
|
||||
export * from './layout/Page.component.js'
|
||||
export * from './layout/Section.component.js'
|
||||
export * from './layout/Modal.component.js'
|
||||
export * from './nav/NavBar.component.js'
|
||||
|
@ -0,0 +1,122 @@
|
||||
import {ExComponent} from '../ExComponent.js'
|
||||
import {Attribute, Component, Element, Renders} from '../decorators.js'
|
||||
|
||||
@Component('ex-modal')
|
||||
export class ModalComponent extends ExComponent {
|
||||
protected static html = `
|
||||
<style>
|
||||
:root {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.container {
|
||||
--modal-color: var(--color-accent);
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 2000;
|
||||
position: fixed;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
padding-top: 2%;
|
||||
}
|
||||
|
||||
.ex-modal {
|
||||
width: 95vw;
|
||||
max-height: min(90vh, 700px);
|
||||
max-width: 600px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 7px;
|
||||
margin: 0 auto;
|
||||
background-color: var(--color-background);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ex-modal header {
|
||||
min-height: 40px;
|
||||
height: 40px;
|
||||
color: var(--color-text);
|
||||
background-color: var(--color-background-darkened);
|
||||
display: grid;
|
||||
padding-left: 14px;
|
||||
align-items: center;
|
||||
grid-template-columns: auto 40px;
|
||||
}
|
||||
|
||||
.ex-modal header h4 {
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.ex-modal header span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-size: 20px;
|
||||
opacity: 0.8;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ex-modal header span:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.ex-modal .main {
|
||||
flex: 1;
|
||||
text-align: left;
|
||||
overflow: auto;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.ex-modal footer {
|
||||
height: auto;
|
||||
text-align: right;
|
||||
padding: 14px;
|
||||
background-color: var(--color-background-darkened);
|
||||
}
|
||||
|
||||
.ex-modal footer button, .ex-modal footer input {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ex-modal footer button:not(:last-child), .ex-modal footer input:not(:last-child) {
|
||||
margin-right: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div class="ex-modal" tabindex="0">
|
||||
<header>
|
||||
<h4 class="modal-title"></h4>
|
||||
<span>✖</span>
|
||||
</header>
|
||||
<div class="main">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<footer>
|
||||
<slot name="footer"></slot>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
@Attribute()
|
||||
public header = ''
|
||||
|
||||
@Renders()
|
||||
public shown = false
|
||||
|
||||
@Element('h4.modal-title')
|
||||
protected headerEl!: HTMLHeadingElement
|
||||
|
||||
render(): void {
|
||||
super.render()
|
||||
|
||||
this.headerEl.innerText = this.header
|
||||
this.style.display = this.shown ? 'unset' : 'none'
|
||||
}
|
||||
}
|
@ -0,0 +1,325 @@
|
||||
:root {
|
||||
--default-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
||||
--color-background: #f9f9f9;
|
||||
--color-background-darkened: #f0f0f0;
|
||||
--color-text: #333333;
|
||||
--color-text-darkened: #2d2d2d;
|
||||
--color-accent: #2E5252;
|
||||
--color-accent-hover: #437777;
|
||||
--color-accent-darkened: #2a4b4b;
|
||||
--color-text-on-accent: var(--color-background);
|
||||
--color-accent-text: var(--color-accent);
|
||||
|
||||
--color-primary: var(--color-accent);
|
||||
--text-primary: var(--color-text);
|
||||
--color-secondary: var(--color-text);
|
||||
--color-secondary-darkened: var(--color-text-darkened);
|
||||
--text-secondary: var(--color-background);
|
||||
--color-success: #28a745;
|
||||
--color-success-darkened: #189735;
|
||||
--color-success-darkened-2: #139230;
|
||||
--color-warning: #ffc107;
|
||||
--color-warning-darkened: #efb100;
|
||||
--color-warning-darkened-2: #e9ac00;
|
||||
--color-danger: #dc3545;
|
||||
--color-danger-darkened: #cc2535;
|
||||
--color-danger-darkened-2: #c72030;
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-background: #333333;
|
||||
--color-background-darkened: #2d2d2d;
|
||||
--color-text: #f9f9f9;
|
||||
--color-text-darkened: #f0f0f0;
|
||||
--color-accent-text: #5e9b9b;
|
||||
--color-text-on-accent: var(--color-text);
|
||||
--color-accent-hover: #2E5252;
|
||||
--color-accent-darkened: #3b6969;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: var(--default-font);
|
||||
background-color: var(--color-background);
|
||||
color: var(--color-text);
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: var(--default-font);
|
||||
font-weight: bold;
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 1.5rem;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
h1 { font-size: 2.35em }
|
||||
h2 { font-size: 2.00em }
|
||||
h3 { font-size: 1.75em }
|
||||
h4 { font-size: 1.5em }
|
||||
h5 { font-size: 1.25em }
|
||||
h6 { font-size: 1.1em }
|
||||
|
||||
p {
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
small, sub, sup {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: var(--color-accent-text);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--color-accent-hover);
|
||||
border-bottom: 2px solid var(--color-text);
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: var(--color-accent-text);
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 1.4em;
|
||||
margin-top: 0;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding-left: 1em;
|
||||
padding-top: 0.8em;
|
||||
padding-bottom: 0.8em;
|
||||
padding-right: 0.8em;
|
||||
border-left: 5px solid var(--color-accent);
|
||||
margin-bottom: 2.5rem;
|
||||
background-color: var(--color-background-darkened);
|
||||
line-height: 1.35;
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
blockquote.ex-success {
|
||||
border-left: 5px solid var(--color-success);
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
blockquote.ex-warning {
|
||||
border-left: 5px solid var(--color-warning);
|
||||
color: var(--color-warning);
|
||||
}
|
||||
|
||||
blockquote.ex-danger {
|
||||
border-left: 5px solid var(--color-danger);
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
blockquote p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
img, video {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
margin-top: 0;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: var(--color-background-darkened);
|
||||
display: block;
|
||||
padding: 1em;
|
||||
overflow-x: auto;
|
||||
margin-top: 1.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 1.1em;
|
||||
padding: 0 0.5em;
|
||||
background-color: var(--color-background-darkened);
|
||||
border-radius: 7px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre > code {
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
table {
|
||||
text-align: justify;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 0.5em;
|
||||
border-bottom: 1px solid var(--color-background-darkened);
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: var(--color-background-darkened);
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
border: 1px solid var(--color-text);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input:focus, textarea:focus {
|
||||
border: 1px solid var(--color-accent);
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.button, button, input[type="submit"], input[type="reset"], input[type="button"] {
|
||||
display: inline-block;
|
||||
padding: 7px 12px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
|
||||
background-color: var(--color-accent);
|
||||
color: var(--color-text-on-accent);
|
||||
border: 1px solid var(--color-accent-darkened);
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
border-radius: 7px;
|
||||
|
||||
transition: background-color 0.1s linear;
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.button.ex-secondary, button.ex-secondary, input[type="submit"].ex-secondary, input[type="reset"].ex-secondary, input[type="button"].ex-secondary {
|
||||
background-color: var(--color-secondary);
|
||||
border-color: var(--color-secondary-darkened);
|
||||
color: var(--color-background);
|
||||
}
|
||||
|
||||
.button.ex-success, button.ex-success, input[type="submit"].ex-success, input[type="reset"].ex-success, input[type="button"].ex-success {
|
||||
background-color: var(--color-success);
|
||||
border-color: var(--color-success-darkened);
|
||||
}
|
||||
|
||||
.button.ex-warning, button.ex-warning, input[type="submit"].ex-warning, input[type="reset"].ex-warning, input[type="button"].ex-warning {
|
||||
background-color: var(--color-warning);
|
||||
border-color: var(--color-warning-darkened);
|
||||
}
|
||||
|
||||
.button.ex-danger, button.ex-danger, input[type="submit"].ex-danger, input[type="reset"].ex-danger, input[type="button"].ex-danger {
|
||||
background-color: var(--color-danger);
|
||||
border-color: var(--color-danger-darkened);
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: dark) {
|
||||
.button.ex-success, button.ex-success, input[type="submit"].ex-success, input[type="reset"].ex-success, input[type="button"].ex-success {
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.button.ex-warning, button.ex-warning, input[type="submit"].ex-warning, input[type="reset"].ex-warning, input[type="button"].ex-warning {
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.button.ex-danger, button.ex-danger, input[type="submit"].ex-danger, input[type="reset"].ex-danger, input[type="button"].ex-danger {
|
||||
color: var(--color-text);
|
||||
}
|
||||
}
|
||||
|
||||
.button[disabled], button[disabled], input[type="submit"][disabled], input[type="reset"][disabled], input[type="button"][disabled] {
|
||||
cursor: default;
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
.button:focus:enabled, button:focus:enabled, input[type="submit"]:focus:enabled, input[type="reset"]:focus:enabled, input[type="button"]:focus:enabled,
|
||||
.button:hover:enabled, button:hover:enabled, input[type="submit"]:hover:enabled, input[type="reset"]:hover:enabled, input[type="button"]:hover:enabled {
|
||||
background-color: var(--color-accent-darkened);
|
||||
border-color: var(--color-accent-darkened);
|
||||
color: var(--color-text-on-accent);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.button.ex-secondary:focus:enabled, button.ex-secondary:focus:enabled, input.ex-secondary[type="submit"]:focus:enabled, input.ex-secondary[type="reset"]:focus:enabled, input.ex-secondary[type="button"]:focus:enabled,
|
||||
.button.ex-secondary:hover:enabled, button.ex-secondary:hover:enabled, input.ex-secondary[type="submit"]:hover:enabled, input.ex-secondary[type="reset"]:hover:enabled, input.ex-secondary[type="button"]:hover:enabled {
|
||||
background-color: var(--color-secondary-darkened);
|
||||
border-color: var(--color-secondary-darkened);
|
||||
color: var(--color-background-darkened);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.button.ex-success:focus:enabled, button.ex-success:focus:enabled, input.ex-success[type="submit"]:focus:enabled, input.ex-success[type="reset"]:focus:enabled, input.ex-success[type="button"]:focus:enabled,
|
||||
.button.ex-success:hover:enabled, button.ex-success:hover:enabled, input.ex-success[type="submit"]:hover:enabled, input.ex-success[type="reset"]:hover:enabled, input.ex-success[type="button"]:hover:enabled {
|
||||
background-color: var(--color-success-darkened);
|
||||
border-color: var(--color-success-darkened);
|
||||
color: var(--color-background-darkened);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.button.ex-warning:focus:enabled, button.ex-warning:focus:enabled, input.ex-warning[type="submit"]:focus:enabled, input.ex-warning[type="reset"]:focus:enabled, input.ex-warning[type="button"]:focus:enabled,
|
||||
.button.ex-warning:hover:enabled, button.ex-warning:hover:enabled, input.ex-warning[type="submit"]:hover:enabled, input.ex-warning[type="reset"]:hover:enabled, input.ex-warning[type="button"]:hover:enabled {
|
||||
background-color: var(--color-warning-darkened);
|
||||
border-color: var(--color-warning-darkened);
|
||||
color: var(--color-background-darkened);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.button.ex-danger:focus:enabled, button.ex-danger:focus:enabled, input.ex-danger[type="submit"]:focus:enabled, input.ex-danger[type="reset"]:focus:enabled, input.ex-danger[type="button"]:focus:enabled,
|
||||
.button.ex-danger:hover:enabled, button.ex-danger:hover:enabled, input.ex-danger[type="submit"]:hover:enabled, input.ex-danger[type="reset"]:hover:enabled, input.ex-danger[type="button"]:hover:enabled {
|
||||
background-color: var(--color-danger-darkened);
|
||||
border-color: var(--color-danger-darkened);
|
||||
color: var(--color-background-darkened);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
textarea, select, input {
|
||||
color: var(--color-text);
|
||||
padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */
|
||||
margin-bottom: 10px;
|
||||
background-color: var(--color-background-darkened);
|
||||
border: 1px solid var(--color-background-darkened);
|
||||
border-radius: 4px;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
font-size: 1.0em;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
color: var(--color-accent-text);
|
||||
}
|
||||
|
||||
textarea:focus, select:focus, input:focus {
|
||||
border: 1px solid var(--color-accent);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:focus {
|
||||
outline: 1px dotted var(--color-accent);
|
||||
}
|
||||
|
||||
label, legend, fieldset {
|
||||
display: block;
|
||||
margin-bottom: .5rem;
|
||||
font-weight: 600;
|
||||
}
|
Loading…
Reference in new issue