Style updates, doc updates

This commit is contained in:
James Eversole 2024-02-25 15:01:56 -06:00
parent 1ef77413db
commit 8e1bedf9ec
6 changed files with 67 additions and 20 deletions

View File

@ -14,18 +14,46 @@ Therefore, `la sampu cu sampu lo ka samtci`!
- [Haskell](https://www.haskell.org)
- [Twain](https://github.com/alexmingoia/twain)
- [Lucid2](https://chrisdone.com/posts/lucid2)
- [Lucid](https://github.com/chrisdone/lucid)
- [Clay](https://github.com/sebastiaanvisser/clay)
## Goal
Provide a simple blog engine that is easily customizable via HTML fragments.
## Deployment
## Build and Deployment
We're not there yet! This project is built and packaged with Nix,
so I will provide directions on deploying with Nix as well as via OCI
containers once there's something viable to run.
Only Nix build instructions are provided below.
### No Containers
1) Clone this repository
2) Build the application (with flakes enabled): `nix build '.#'`
3) Set the environment variables
- File: `cp data/.env.example ./.env; $EDITOR ./.env`
- If you want to set them in a different way, you already know how.
4) Run the application: `./result/bin/sampu`
### Containers
1) Clone this repository
2) Build the container image (with flakes enabled): `nix build .#sampu-container`
3) Load the container image: `podman load -i result`
4) Run the container using your favorite orchestrator or...
5) Use a NixOS configuration:
```
virtualisation.oci-containers.containers.sampu = {
image = "sampu";
ports = [ "${SAMPUR_EXTERNAL_PORT}:3000" ];
volumes = [
"/PATH/TO/SAMPU/data:/app/data"
];
environment = {
SAMPU_PORT = "3000";
SAMPU_TITLE = "Your Blog Title Here!";
SAMPU_BASEURL = "http://example.public.tld";
};
};
```
## Development and Support
Per the permissive ISC license, you are free to do what you wish with this

0
data/assets/public/test Normal file
View File

View File

@ -1,6 +1,6 @@
cabal-version: 3.0
name: sampu
version: 0.6.0
version: 0.7.0
license: ISC
author: James Eversole
maintainer: james@eversole.co
@ -28,6 +28,7 @@ executable sampu
, time >= 1.12.0
, twain >= 2.1.0.0
, wai-extra >= 3.0 && < 3.2
, wai-middleware-static >= 0.9.0
, warp == 3.3.25
, xml-conduit >= 1.9.1.0
hs-source-dirs: src

View File

@ -7,6 +7,7 @@ import Control.Monad ( mapM_ )
import Data.String ( fromString )
import Network.Wai.Handler.Warp ( Port, run )
import Network.Wai.Middleware.RequestLogger ( logStdout, logStdoutDev )
import Network.Wai.Middleware.Static ( staticPolicy, noDots, addBase, (>->) )
import System.FilePath ( takeFileName )
@ -24,7 +25,9 @@ main postNames = do
-- These Middlewares are executed before any routes are reached.
preProcessors :: [Middleware]
preProcessors = [logStdoutDev]
preProcessors = [ logStdoutDev
, staticPolicy (noDots >-> addBase "data/assets/public")
]
-- These Middlewares are executed after all other routes are exhausted
postProcessors :: [Middleware]

View File

@ -17,15 +17,16 @@ composedStyles :: Css
composedStyles = do
core_
main_
nav_
notFound_
postList_
nav_
mobileFriendly_
core_ :: Css
core_ = do
a_
body_
code_
footer_
html_
p_
@ -39,11 +40,14 @@ a_ = do
body_ :: Css
body_ = do
body ? do
fontFamily [] [monospace]
fontSize $ em 1.25
fontWeight $ weight 300
textAlign start
margin (em 0) auto (em 0) auto
display flex
minHeight $ vh 100
flexDirection column
fontFamily [] [monospace]
fontSize $ em 1.25
fontWeight $ weight 300
textAlign start
margin (em 0) auto (em 0) auto
strong ? do
fontWeight $ weight 600
li ? do
@ -52,11 +56,10 @@ body_ = do
footer_ :: Css
footer_ = do
footer ? do
position absolute
margin (em 0) (em 0) (em 0) (em 0)
bottom (em 0)
margin auto (em 0) (em 0) (em 0)
width $ pct 100
backgroundColor $ rgba 109 146 173 0.3
backgroundColor terColor
textAlign center
padding (em 1) (em 0) (em 1) (em 0)
boxSizing borderBox
@ -76,13 +79,14 @@ html_ = do
p_ :: Css
p_ = do
p ? do
margin (em 0.4) (em 0) (em 0.4) (em 0)
margin (em 1) (em 0) (em 0.6) (em 0)
main_ :: Css
main_ = do
".main" ? do
margin (em 0) auto (em 0) auto
maxWidth $ pct 60
minWidth $ pct 40
notFound_ :: Css
notFound_ = do
@ -97,7 +101,18 @@ notFound_ = do
postList_ :: Css
postList_ = do
".postList" ? do
margin (em 0) auto (em 0) auto
fontSize (em 1.5)
minWidth (pct 60)
maxWidth (pct 95)
overflow scroll
code_ :: Css
code_ = do
code ? do
color priColor
backgroundColor terColor
overflowX scroll
nav_ :: Css
nav_ = do
@ -107,7 +122,7 @@ nav_ = do
textAlign center
".mainNav" ? do
margin (em 0) auto (em 0) auto
padding (em 0) (em 0) (em 0) (em 0)
padding (em 0.5) (em 0.5) (em 0.5) (em 0.5)
overflow hidden
boxShadow . pure $ bsColor "#ccc" $ shadowWithBlur (px 4) (px 4) (px 6)
display inlineFlex

View File

@ -37,9 +37,9 @@ basePost :: Html () -> Html ()
basePost content = div_ [class_ "main"] content
postIndex :: [FilePath] -> Html ()
postIndex postNames = div_ [class_ "main"] $ do
postIndex postNames = div_ [class_ "postList"] $ do
h1_ [class_ "title"] "All Posts"
ul_ [class_ "postList"] $ do
ul_ [] $ do
mapM_
(\x -> li_ $ a_ [href_ (pack $ "/posts/" ++ x)] (fromString x))
postNames