Skip to content

Commit

Permalink
move coretheme to the beginning of themes, add genie_footer, googlefo…
Browse files Browse the repository at this point in the history
…nts_css, stipplecore_css
  • Loading branch information
hhaensel committed Oct 11, 2024
1 parent 287d8db commit 32ce907
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
40 changes: 37 additions & 3 deletions src/Layout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ using Genie, Stipple
export layout, add_css, remove_css
export page, app, row, column, cell, container, flexgrid_kwargs, htmldiv, @gutter

export theme
export theme, googlefonts_css, stipplecore_css, genie_footer

const THEMES = Ref(Function[])

const FLEXGRID_KWARGS = [:col, :xs, :sm, :md, :lg, :xl, :gutter, :xgutter, :ygutter]
Expand Down Expand Up @@ -122,6 +123,31 @@ function iscontainer(class)
false
end

function genie_footer()
ParsedHTMLString("""
<style>
._genie_logo {
background:url('https://genieframework.com/logos/genie/logo-simple-with-padding.svg') no-repeat;
background-size:40px;
padding-top:22px;
padding-right:10px;
color:transparent !important;
font-size:9pt;
}
._genie .row .col-12 { width:50%; margin:auto; }
</style>
<footer class='_genie container'>
<div class='row'>
<div class='col-12'>
<p class='text-muted credit' style='text-align:center;color:#8d99ae;'>Built with
<a href='https://genieframework.com' target='_blank' class='_genie_logo' ref='nofollow'>Genie</a>
</p>
</div>
</div>
</footer>
""")
end

function flexgrid_class(tag::Symbol, value::Union{String,Int,Nothing,Symbol} = -1, container = false)
gutter = container ? "q-col-gutter" : "q-gutter"
(value == -1 || value === nothing) && return ""
Expand Down Expand Up @@ -507,6 +533,14 @@ function htmldiv(args...;
Genie.Renderer.Html.div(args...; kwargs...)
end

function googlefonts_css()
(stylesheet("https://fonts.googleapis.com/css?family=Material+Icons"),)
end

function stipplecore_css()
(stylesheet(Genie.Assets.asset_path(Stipple.assets_config, :css, file="stipplecore")),)
end

function coretheme()
stylesheet("https://fonts.googleapis.com/css?family=Material+Icons"),
stylesheet(Genie.Assets.asset_path(Stipple.assets_config, :css, file="stipplecore"))
Expand All @@ -533,11 +567,11 @@ julia> push!(Stipple.Layout.THEMES[], StippleUI.theme)
function theme(; core_theme::Bool = true) :: Vector{String}
output = String[]

core_theme && coretheme THEMES[] && push!(output, coretheme()...)

for f in THEMES[]
push!(output, f()...)
end

core_theme && coretheme THEMES[] && push!(output, coretheme()...)

output
end
Expand Down
6 changes: 4 additions & 2 deletions src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ const TYPES = LittleDict{Module,Union{<:DataType,Nothing}}()
const HANDLERS_FUNCTIONS = LittleDict{Type{<:ReactiveModel},Function}()

function DEFAULT_LAYOUT(; title::String = "Genie App",
meta::D = Dict(), head_content::Union{AbstractString, Vector} = "") where {D <:AbstractDict}
meta::D = Dict(),
head_content::Union{AbstractString, Vector} = "",
core_theme::Bool = true) where {D <:AbstractDict}
tags = Genie.Renderers.Html.for_each(x -> """<meta name="$(string(x.first))" content="$(string(x.second))">\n""", meta)
"""
<!DOCTYPE html>
Expand Down Expand Up @@ -73,7 +75,7 @@ function DEFAULT_LAYOUT(; title::String = "Genie App",
<div class='container'>
<div class='row'>
<div class='col-12'>
<% Stipple.page(model, partial = true, v__cloak = true, [Stipple.Genie.Renderer.Html.@yield], Stipple.@if(:isready)) %>
<% Stipple.page(model, partial = true, v__cloak = true, [Stipple.Genie.Renderer.Html.@yield], Stipple.@if(:isready); core_theme = $core_theme) %>
</div>
</div>
</div>
Expand Down

0 comments on commit 32ce907

Please sign in to comment.