Skip to content

Commit 8bdf179

Browse files
committed
Ditch bootstrap from docs in favor of pico.css
1 parent 0f526dd commit 8bdf179

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+232
-335
lines changed

hepek-components/shared/src/main/scala/ba/sake/hepek/bootstrap5/BootstrapPage.scala

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,4 @@ package ba.sake.hepek.bootstrap5
22

33
import ba.sake.hepek.html.*
44

5-
trait BootstrapPage extends HtmlPage with BootstrapDependencies {
6-
7-
override def stylesInline = List(
8-
"""
9-
nav#tocScrollspy {
10-
display: none;
11-
}
12-
13-
.affix {
14-
width: 100%;
15-
}
16-
17-
@media (min-width: 991px) {
18-
.affix {
19-
position: fixed;
20-
width: 15%;
21-
height: 80vh;
22-
overflow: auto;
23-
}
24-
25-
nav#tocScrollspy {
26-
display: block;
27-
}
28-
}
29-
"""
30-
)
31-
}
5+
trait BootstrapPage extends HtmlPage with BootstrapDependencies

hepek-components/shared/src/main/scala/ba/sake/hepek/html/HtmlPage.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,9 @@ trait HtmlPage extends PageDependencies {
140140
)
141141
}
142142

143-
def pageContent: Frag = frag()
143+
def pageContent: Frag = tag("main")(
144+
mainContent
145+
)
146+
147+
def mainContent: Frag = frag()
144148
}

hepek-components/shared/src/main/scala/ba/sake/hepek/plain/PlainDependencies.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package ba.sake.hepek.plain
22

3-
import ba.sake.hepek.jquery.JQueryDependencies
3+
import ba.sake.hepek.html.PageDependencies
44

55
// stolen from https://hacks.mozilla.org/2017/04/replace-bootstrap-layouts-with-css-grid/
6-
trait PlainDependencies extends JQueryDependencies {
6+
trait PlainDependencies extends PageDependencies {
77

88
private val gridStyles = {
99
val Total = 12
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

2-
var parent = "section";
32
for (i = 1; i <= 6; i++) {
4-
// CSS selectors "section h1", "section h2" ...
5-
anchors.add(parent + ' h' + i);
3+
// CSS selectors "h1", "h2" ...
4+
anchors.add('h' + i);
65
}
Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11

2-
body {
3-
font-size: 16px;
4-
padding-bottom: 33px;
5-
padding-top: 4.5rem; /* fixed top navbar */
6-
}
7-
8-
.navbar-brand {
9-
padding: 10px 15px;
10-
}
11-
.navbar-brand img {
12-
width: 24px;
13-
height: auto;
2+
.flex-centered {
3+
display: flex;
4+
justify-content: center;
5+
align-items: center;
6+
gap: 1rem;
147
}
158

169
/* default SVG maximum height */
@@ -19,24 +12,18 @@ object[type="image/svg+xml"] {
1912
width: 100%;
2013
}
2114

22-
.pages-toc ul {
23-
list-style: none;
24-
}
25-
26-
.pages-toc > ul > li > a {
27-
font-weight: bold;
28-
font-size: 17px;
29-
}
30-
31-
/* prismjs sets 0.3em and then we get unnecessary horizontal slider. This fixes it. */
32-
pre[class*="language-"] {
33-
border-width: 0.3rem !important;
34-
}
3515

36-
/* anchor offset when clicking it :) https://stackoverflow.com/a/22655654/4496364 */
37-
:target:before {
38-
content: "";
39-
display: block;
40-
height: 50px;
41-
margin: -50px 0 0;
16+
@media (min-width: 768px) {
17+
.blog-post {
18+
display: grid;
19+
grid-template-areas: "left-menu main-content";
20+
}
21+
.left-menu {
22+
grid-area: left-menu;
23+
padding: 1rem;
24+
}
25+
.main-content {
26+
grid-area: main-content;
27+
padding: 1rem;
28+
}
4229
}
Lines changed: 26 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,37 @@
11
package files
22

3-
import utils.Imports.Bundle.*
4-
import Tags.*
5-
import Grid.*
6-
73
object Index extends templates.HepekDocsStaticPage {
84

95
override def pageSettings =
106
super.pageSettings
117
.withTitle("Welcome!")
128
.withDescription("Hepek docs")
139

14-
override def pageContent =
15-
div(cls := "container")(
16-
Navbar.nav(
17-
brandUrl = staticSiteSettings.indexPage.map(_.ref).getOrElse("#"),
18-
brandName = siteSettings.name.map(" " + _),
19-
brandIconUrl = siteSettings.faviconInverted,
20-
// TODO add to other pages too
21-
left = form(action := SearchResults.ref, method := "GET", cls := "form-inline")(
22-
input(
23-
name := "q",
24-
tpe := "search",
25-
cls := "form-control",
26-
placeholder := "Search"
27-
)
28-
),
29-
right = for
30-
page <- staticSiteSettings.mainPages
31-
labela = page.pageCategory.getOrElse(page.pageSettings.label)
32-
yield Navbar.link(page.ref, labela)
33-
),
34-
row(
35-
s"""
36-
Hepek is a collection of useful projects for making websites in Scala:
37-
- [Components](${hepek.components.Index.ref}) (JVM and ScalaJS)
38-
- [Static Site Generator](${hepek.Index.ref})
39-
- [Framework Integrations](${integrations.Index.ref})
40-
41-
## Hepek Components
42-
Components is a standalone library with minimal dependencies.
43-
They provide utilites for grid, form inputs, panels, navbars, markdown, code highlighting, maths rendering and lots more.
44-
Components support frameworks like Bootstrap 5, Bulma, HTMX etc.
45-
You can switch to a different framework with minimal effort and override parts you don't like.
46-
47-
## Hepek SSG
48-
SSG has support for automatic relative links, PDF rendering and lots more.
49-
50-
## Hepek Frameworks Integrations
51-
Integrations provide Hepek Components support for various frameworks:
52-
[Sharaf](https://github.com/sake92/sharaf),
53-
[Play](https://www.playframework.com/),
54-
[Http4s](https://http4s.org),
55-
[ZIO Http](https://zio.dev/zio-http/).
56-
57-
For any questions/bugs/features please make an issue in the [GitHub](https://github.com/sake92/hepek/issues) repo,
58-
and you can also join our [Discord chat](https://discord.gg/R2FtxDKyRE)
59-
""".md
60-
),
61-
super.pageContent
62-
)
10+
override def mainContent =
11+
s"""
12+
Hepek is a collection of useful projects for making websites in Scala:
13+
- [Components](${hepek.components.Index.ref}) (JVM and ScalaJS)
14+
- [Static Site Generator](${hepek.Index.ref})
15+
- [Framework Integrations](${integrations.Index.ref})
16+
17+
## Hepek Components
18+
Components is a standalone library with minimal dependencies.
19+
They provide utilites for grid, form inputs, panels, navbars, markdown, code highlighting, maths rendering and lots more.
20+
Components support frameworks like Bootstrap 5, Bulma, HTMX etc.
21+
You can switch to a different framework with minimal effort and override parts you don't like.
22+
23+
## Hepek SSG
24+
SSG has support for automatic relative links, PDF rendering and lots more.
25+
26+
## Hepek Frameworks Integrations
27+
Integrations provide Hepek Components support for various frameworks:
28+
[Sharaf](https://github.com/sake92/sharaf),
29+
[Play](https://www.playframework.com/),
30+
[Http4s](https://http4s.org),
31+
[ZIO Http](https://zio.dev/zio-http/).
32+
33+
For any questions/bugs/features please make an issue in the [GitHub](https://github.com/sake92/hepek/issues) repo,
34+
and you can also join our [Discord chat](https://discord.gg/R2FtxDKyRE)
35+
""".md
6336

6437
}
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package files
22

33
import ba.sake.hepek.core.RelativePath
4-
import ba.sake.hepek.scalatags.all.*
5-
import utils.Imports.Bundle.*
64
import utils.Site
75

86
object NotFound extends templates.HepekDocsAbstractPage {
@@ -15,11 +13,10 @@ object NotFound extends templates.HepekDocsAbstractPage {
1513
override def relTo(other: RelativePath) =
1614
Site.url + "/" + super.relTo(other)
1715

18-
override def pageContent =
19-
div(Classes.txtAlignCenter)(
20-
s"""
21-
This page does not exist... :///
22-
Click [here](${Site.url}) to go back
23-
""".md
24-
)
16+
override def mainContent =
17+
s"""
18+
This page does not exist... :///
19+
Click [here](${Site.url}) to go back
20+
""".md
21+
2522
}

hepek-docs/src/main/scala/files/SearchIndex.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ package files
22

33
import ba.sake.hepek.fusejs.FusejsIndex
44
import ba.sake.hepek.html.statik.StaticPage
5+
import utils.Site
56

67
object SearchIndex extends FusejsIndex {
78

8-
override def indexedPages: Seq[StaticPage] = Seq(Index) ++
9-
files.hepek.components.Index.categoryPosts ++
10-
files.hepek.Index.categoryPosts ++
11-
files.integrations.Index.categoryPosts
9+
override def indexedPages: Seq[StaticPage] =
10+
Site.allSearchIndexedPages
1211

1312
}

hepek-docs/src/main/scala/files/SearchResults.scala

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
package files
22

33
import ba.sake.tupson.toJson
4-
import utils.Imports.Bundle.*
5-
import Tags.*
6-
import Grid.*
4+
import scalatags.Text.all.*
75

86
object SearchResults extends templates.HepekDocsStaticPage {
97

10-
override def pageContent =
11-
div(cls := "container")(
12-
div(
13-
h1("Search results"),
14-
div(id := "search-results-content")(
15-
p("Loading...")
16-
)
17-
)
8+
override def mainContent = div(
9+
h1("Search results"),
10+
div(id := "search-results-content")(
11+
p("Loading...")
1812
)
13+
)
1914

20-
private val fuseList = SearchIndex.fusejsIndexedPagesData.toJson
15+
private lazy val fuseList = SearchIndex.fusejsIndexedPagesData.toJson
2116

2217
override def scriptsInline: List[String] = super.scriptsInline ++ List(s"""
2318
import Fuse from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/fuse.mjs'

hepek-docs/src/main/scala/files/hepek-components/HepekComponentsDocsPage.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package files.hepek.components
22

33
import ba.sake.hepek.html.statik.BlogPostPage
4-
import utils.Imports.Bundle.Navbar
54

65
trait HepekComponentsDocsPage extends templates.HepekDocsAbstractPage {
76

@@ -12,5 +11,5 @@ trait HepekComponentsDocsPage extends templates.HepekDocsAbstractPage {
1211

1312
override def pageCategory = Some(Index.pageSettings.label)
1413

15-
override def navbar = Some(Navbar.withActiveUrl(Index.ref))
14+
override def currentCategoryPage = Some(Index)
1615
}

0 commit comments

Comments
 (0)