Skip to content

Commit

Permalink
feat: custom any heading
Browse files Browse the repository at this point in the history
  • Loading branch information
dd84ai committed Mar 29, 2024
1 parent 0b8f095 commit 6087df3
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
env:
SITE_ROOT: "/fl-darkstat/"
FLDARKSTAT_FREELANCER_FOLDER: ${{ github.workspace }}/fl-data
FLDARKSTAT_HEADING: "Dev server for darkstat | <a href=\"https://github.com/darklab8/fl-darkstat\">Github</a>"

- uses: actions/upload-pages-artifact@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"FLDARKSTAT_FREELANCER_FOLDER": "/home/naa/windows10shared/Discovery/DiscoveryFreelancer",
"DARKSTAT_LOG_LEVEL": "DEBUG",
"UTILS_LOG_LEVEL": "DEBUG",
"FLDARKSTAT_HEADING": "Dev server for darkstat | <a href=\"https://github.com/darklab8/fl-darkstat\">Github</a>",
}
}
1 change: 1 addition & 0 deletions darkstat/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (b *Builder) BuildAll() *Filesystem {
SiteRoot: siteRoot,
StaticRoot: siteRoot + staticPrefix,
OppositeThemeRoot: siteRoot + "dark/",
Heading: os.Getenv("FLDARKSTAT_HEADING"),
}, filesystem)

// Implement dark theme later
Expand Down
1 change: 1 addition & 0 deletions darkstat/common/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type GlobalParams struct {
StaticRoot string
OppositeThemeRoot string
Pagepath string
Heading string
}

func GetCtx(ctx context.Context) GlobalParams {
Expand Down
40 changes: 35 additions & 5 deletions darkstat/front/shared.templ
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,49 @@ templ TabContent() {
</style>
}

templ Heading() {
<style>
.heading {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.right {
margin: 10px;
}
</style>
<div class="heading">
<div class="left">
{ children... }
</div>
<div class="right">
@templ.Raw(types.GetCtx(ctx).Heading)
</div>
</div>
}

templ TabMenu(url utils_types.FilePath) {
<style>
.tab-list {
height: 100%;

.selected {
filter: brightness(85%);
}
& button {
min-width: 100px;
min-height: 30px;
height: 100%;
}
}
</style>
<div class="tab-list" role="tablist">
<button hx-get={ types.GetCtx(ctx).SiteRoot + urls.Bases.ToString() } class={ templ.KV("selected", urls.Bases == url) } role="tab" aria-selected="false" aria-controls="tab-content">Bases</button>
<button hx-get={ types.GetCtx(ctx).SiteRoot + urls.Factions.ToString() } class={ templ.KV("selected", urls.Factions == url) } role="tab" aria-selected="false" aria-controls="tab-content">Factions</button>
<button hx-get={ types.GetCtx(ctx).SiteRoot + urls.Rephacks.ToString() } class={ templ.KV("selected", urls.Rephacks == url) } role="tab" aria-selected="false" aria-controls="tab-content">Rephacks</button>
</div>
@Heading() {
<div class="tab-list" role="tablist">
<button hx-get={ types.GetCtx(ctx).SiteRoot + urls.Bases.ToString() } class={ templ.KV("selected", urls.Bases == url) } role="tab" aria-selected="false" aria-controls="tab-content">Bases</button>
<button hx-get={ types.GetCtx(ctx).SiteRoot + urls.Factions.ToString() } class={ templ.KV("selected", urls.Factions == url) } role="tab" aria-selected="false" aria-controls="tab-content">Factions</button>
<button hx-get={ types.GetCtx(ctx).SiteRoot + urls.Rephacks.ToString() } class={ templ.KV("selected", urls.Rephacks == url) } role="tab" aria-selected="false" aria-controls="tab-content">Rephacks</button>
</div>
}
<hr/>
}

Expand Down

0 comments on commit 6087df3

Please sign in to comment.