Css + fonts..

This commit is contained in:
Hubert Van De Walle 2020-08-22 22:48:21 +02:00
parent f73a9d0b96
commit ea732325e5
14 changed files with 67 additions and 14 deletions

View File

@ -27,8 +27,9 @@ class Router(
) { ) {
operator fun invoke(): RoutingHttpHandler { operator fun invoke(): RoutingHttpHandler {
val resourceLoader = ResourceLoader.Classpath(("/static"))
val basicRoutes = routes( val basicRoutes = routes(
ImmutableFilter().then(static(ResourceLoader.Classpath(("/static")))), ImmutableFilter().then(static(resourceLoader, "woff2" to ContentType("font/woff2"))),
) )
fun public(request: Request, handler: PublicHandler) = handler(request, request.jwtPayload(contexts)) fun public(request: Request, handler: PublicHandler) = handler(request, request.jwtPayload(contexts))

View File

@ -35,7 +35,10 @@ class BaseView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
</div> </div>
<form class="md:space-x-2" id="search"> <form class="md:space-x-2" id="search">
<input aria-label="demo-search" name="search" disabled="" value="tag:&quot;demo&quot;"> <input aria-label="demo-search" name="search" disabled="" value="tag:&quot;demo&quot;">
<span id="buttons"><button disabled="" class="pointer-events-none">search</button><span>clear</span></span> <span id="buttons">
<button disabled="" class="btn btn-green pointer-events-none">search</button>
<span class="btn btn-red pointer-events-none">clear</span>
</span>
</form> </form>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table id="notes"> <table id="notes">

View File

@ -22,7 +22,7 @@ class NoteView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
alert(Alert.Warning, it.dataPath.substringAfter('.') + ": " + it.message) alert(Alert.Warning, it.dataPath.substringAfter('.') + ": " + it.message)
} }
form(method = FormMethod.post) { form(method = FormMethod.post) {
textArea(classes = "w-full bg-gray-800 p-5 outline-none font-mono") { textArea {
attributes.also { attributes.also {
it["rows"] = "20" it["rows"] = "20"
it["id"] = "markdown" it["id"] = "markdown"

View File

@ -25,6 +25,11 @@ abstract class View(staticFileResolver: StaticFileResolver) {
meta(name = "viewport", content = "width=device-width, initial-scale=1") meta(name = "viewport", content = "width=device-width, initial-scale=1")
title("$title - SimpleNotes") title("$title - SimpleNotes")
description?.let { meta(name = "description", content = it) } description?.let { meta(name = "description", content = it) }
link(rel = "preload", href = "/recursive-0.0.1.woff2"){
attributes["as"] = "font"
attributes["type"] = "font/woff2"
attributes["crossorigin"] = "anonymous"
}
link(rel = "stylesheet", href = styles) link(rel = "stylesheet", href = styles)
link(rel = "shortcut icon", href = "/favicon.ico", type = "image/x-icon") link(rel = "shortcut icon", href = "/favicon.ico", type = "image/x-icon")
scripts.forEach { src -> scripts.forEach { src ->

View File

@ -26,10 +26,10 @@ fun DIV.noteListHeader(numberOfDeletedNotes: Int, query: String = "") {
} }
span { span {
id = "buttons" id = "buttons"
button(type = submit) { button(type = submit, classes = "btn btn-green") {
+"search" +"search"
} }
a(href = "/notes") { a(href = "/notes", classes = "btn btn-red") {
+"clear" +"clear"
} }
} }

Binary file not shown.

View File

@ -1,9 +1,14 @@
.btn { .btn {
@apply font-bold py-2 px-4 rounded; @apply font-semibold py-2 px-4 rounded;
&:focus { &:focus {
@apply outline-none shadow-outline; @apply outline-none shadow-outline;
} }
&:hover {
--CASL: 1;
@apply font-extrabold;
}
} }
.btn-teal { .btn-teal {

19
css/src/fonts.pcss Normal file
View File

@ -0,0 +1,19 @@
@font-face {
font-family: 'Recursive';
font-weight: 300 800;
font-display: swap;
src: url(/recursive-0.0.1.woff2) format('woff2');
}
:root {
--MONO: 0;
--CASL: 0;
--slnt: 0;
--CRSV: 0.5;
}
*,
*:before,
*:after {
font-variation-settings: "MONO" var(--MONO), "CASL" var(--CASL), "slnt" var(--slnt), "CRSV" var(--CRSV);
}

View File

@ -6,7 +6,8 @@
@apply text-2xl text-gray-100 font-bold; @apply text-2xl text-gray-100 font-bold;
&:hover { &:hover {
@apply text-blue-300; @apply text-blue-300 underline font-extrabold;
--CASL: 1;
} }
} }
@ -25,7 +26,8 @@
@apply text-gray-100 font-semibold; @apply text-gray-100 font-semibold;
&:hover { &:hover {
@apply underline text-blue-300; @apply underline text-blue-300 font-bold;
--CASL: 1;
} }
} }
} }

View File

@ -51,7 +51,7 @@
ul, ul,
ol { ol {
ul { ul {
list-style-type: circle; @apply list-disc;
} }
ul, ul,
@ -76,17 +76,23 @@
ul, ul,
ol, ol,
dl { dl {
margin: 0; @apply m-0;
} }
} }
b, b,
strong { strong {
font-weight: bold; @apply font-bold;
} }
pre { pre {
@apply my-4 rounded-md overflow-x-auto p-2 block font-mono bg-gray-800; @apply my-4 rounded-md overflow-x-auto p-2 block font-mono bg-gray-800;
--MONO: 1;
} }
} }
#markdown {
@apply w-full bg-gray-800 p-5 outline-none font-mono;
--MONO: 1;
}

View File

@ -7,6 +7,7 @@
&:hover { &:hover {
@apply bg-teal-800 text-white; @apply bg-teal-800 text-white;
--CASL: 1;
} }
&.disabled { &.disabled {

View File

@ -13,11 +13,11 @@
@apply flex flex-1 justify-between mb-2; @apply flex flex-1 justify-between mb-2;
button { button {
@apply flex-1 btn btn-green; @apply flex-1;
} }
a, span { a, span {
@apply ml-2 flex-1 btn btn-red inline-block text-center; @apply ml-2 flex-1 inline-block text-center;
} }
} }
} }

View File

@ -1,3 +1,5 @@
@import "fonts.pcss";
/*noinspection CssUnknownTarget*/ /*noinspection CssUnknownTarget*/
@import "tailwindcss/base"; @import "tailwindcss/base";

View File

@ -5,7 +5,16 @@ module.exports = {
] ]
}, },
theme: { theme: {
extend: {}, fontFamily: {
'sans': [
'Recursive',
'sans-serif',
],
'mono': [
'Recursive',
'monospace'
],
}
}, },
variants: {}, variants: {},
plugins: [], plugins: [],