Browse Source

Fix some styling issue on mobile; properly version shake

master
Alex Feldman-Crough 2 years ago
parent
commit
cb5280ef06
  1. 66
      doc/res/manual.css
  2. 2
      doc/res/manual.js
  3. 5
      prosidy.cabal
  4. 3
      src/prosidy-manual/Prosidy/Manual.hs
  5. 10
      src/prosidy-manual/Prosidy/Manual/Compile.hs
  6. 28
      src/prosidy-manual/Prosidy/Manual/Version.hs

66
doc/res/manual.css

@ -95,15 +95,6 @@ nav a {
position: relative;
}
nav .current a.viewing::before {
content: "→ ";
display: block;
position: absolute;
right: 100%;
/* font-weight:bold; */
}
nav ol,
nav li
{
@ -223,13 +214,6 @@ footer {
color: var(--nord4);
font-size: 0.8em;
margin: 2rem -1rem -1rem;
min-height: 8rem;
display: grid;
grid-template-columns: max-content max-content;
align-items: center;
justify-items: center;
justify-content: space-around;
}
footer a {
@ -246,10 +230,8 @@ footer a:hover {
}
footer > ul {
line-height: 2;
margin: 0;
padding: 0;
text-align: right;
}
footer > ul > li {
@ -257,26 +239,41 @@ footer > ul > li {
}
/* Special rules for tiny views */
@media screen and (max-width: 60ch) {
@media screen and (max-width: 480px) {
nav {
background-color: var(--nord6);
border: 1px solid var(--nord3);
padding: 1rem 1rem 1px 1rem;
padding: 0.5rem;
margin: 1rem 0;
}
}
/* Special rules for small views */
@media screen and (max-width: 60ch) and (min-width: 40ch) {
@media screen and (max-width: 480px) and (min-width: 320px) {
nav {
float: right;
margin: 0 0 1rem 1rem;
width: 25ch;
}
footer {
padding: 1em;
text-align: left;
}
footer > ul {
margin: 1em 0;
text-align: center;
}
footer > ul > li {
display: inline-block;
margin: 0 1ch;
}
}
/* Special rules for big views */
@media screen and (min-width: 60ch) {
@media screen and (min-width: 480px) {
header > hgroup > h1 {
font-size: 4rem;
}
@ -339,6 +336,27 @@ footer > ul > li {
position: sticky;
top: 1em;
}
nav .current a.viewing::before {
content: "→ ";
display: block;
position: absolute;
right: 100%;
}
footer {
min-height: 8rem;
display: grid;
grid-template-columns: minmax(min-content, 40%) auto;
align-items: center;
justify-items: center;
justify-content: space-around;
}
footer > ul {
text-align: right;
line-height: 2;
}
}
@ -380,11 +398,13 @@ pre.source-code > div.language {
padding: 0.25ch 0.5ch;
text-align: center;
font-weight: bold;
}
}
pre.source-code > div.language::before {
content: "language: ";
font-weight: normal;
font-size: 0.7rem;
line-height: 1;
}
pre.source-code > code {

2
doc/res/manual.js

@ -11,7 +11,7 @@ class CalculateViewing {
update() {
if (!this.currentLinks) return;
const currentTop = window.scrollY + window.innerHeight / 2;
const currentTop = window.scrollY;
let viewing;
for (const section of this.sections) {
if (section.offsetTop > currentTop) break;

5
prosidy.cabal

@ -122,6 +122,8 @@ executable prosidy-manual
, Prosidy.Manual.TableOfContents
, Prosidy.Manual.Highlight
, Prosidy.Manual.Version
build-depends:
prosidy
, prosidyc
@ -130,18 +132,19 @@ executable prosidy-manual
, bytestring ^>= 0.10
, containers ^>= 0.6
, deepseq ^>= 1.4
, directory ^>= 1.3
, filepath ^>= 1.4
, hashable >= 1.2 && < 1.4
, lens ^>= 4.18
, optparse-applicative ^>= 0.15
, shake ^>= 0.18
, skylighting-core ^>= 0.8
, template-haskell >= 2.14 && < 2.16
, text ^>= 1.2
, transformers ^>= 0.5
, unordered-containers ^>= 0.2
, vector ^>= 0.12
-------------------------------------------------------------------------------
executable prosidy-markup
import: prosidy-shared

3
src/prosidy-manual/Prosidy/Manual.hs

@ -9,6 +9,7 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
module Prosidy.Manual where
import Development.Shake.Classes
@ -37,6 +38,7 @@ import Prosidy.Manual.Compile ( compile
, document
)
import Prosidy.Manual.Opts
import Prosidy.Manual.Version (shakeVersionQ)
import Prosidy.Manual.Slug
import Prosidy.Manual.TableOfContents
@ -53,6 +55,7 @@ mainOpts Opts { dbDir, outDir } = Shake.shakeOptions
, Shake.shakeThreads = 0
, Shake.shakeAbbreviations = [(outDir, "$OUTPUT")]
, Shake.shakeProgress = Shake.progressSimple
, Shake.shakeVersion = $(shakeVersionQ)
}
mainBuild :: Opts -> Shake.Rules ()

10
src/prosidy-manual/Prosidy/Manual/Compile.hs

@ -108,6 +108,7 @@ document = mdo
H.meta ! HA.charset "UTF-8"
H.title $ H.text title
H.script mempty ! HA.src "res/manual.js"
H.meta ! HA.name "viewport" ! HA.content "width=device-width, initial-scale=1"
style "res/manual.css"
H.body $ do
H.header . H.hgroup $ do
@ -129,6 +130,15 @@ document = mdo
"Our color scheme is "
H.a "Nord"
! HA.href "https://www.nordtheme.com/"
". Our fonts are "
H.a "PT Serif"
! HA.href "https://www.paratype.com/fonts/pt/pt-serif"
", "
H.a "Playfair Display"
! HA.href "https://github.com/clauseggers/Playfair-Display"
", and "
H.a "Fira Code"
! HA.href "https://github.com/tonsky/FiraCode"
"."
H.ul $ do
H.li $ H.a "Homepage" ! HA.href

28
src/prosidy-manual/Prosidy/Manual/Version.hs

@ -0,0 +1,28 @@
module Prosidy.Manual.Version where
import qualified Development.Shake as Shake
import Language.Haskell.TH (ExpQ, runIO)
import Language.Haskell.TH.Syntax (lift)
import System.FilePath ((</>))
import qualified System.Directory as Dir
import qualified Data.Set as Set
import Data.Set (Set)
shakeVersionQ :: ExpQ
shakeVersionQ = lift =<< runIO calculateShakeVersion
calculateShakeVersion :: IO String
calculateShakeVersion = do
files <- listDirectoryRecursive "src/prosidy-manual"
print files
Shake.getHashedShakeVersion (Set.toList files)
listDirectoryRecursive :: FilePath -> IO (Set FilePath)
listDirectoryRecursive dir = do
contents <- Dir.listDirectory dir
flip foldMap contents $ \fileSansDir -> do
let file = dir </> fileSansDir
isDir <- Dir.doesDirectoryExist file
if isDir
then listDirectoryRecursive file
else pure (Set.singleton file)
Loading…
Cancel
Save