diff --git a/src/Layout.jl b/src/Layout.jl index 7b377d46..86be5b9a 100644 --- a/src/Layout.jl +++ b/src/Layout.jl @@ -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] @@ -122,6 +123,31 @@ function iscontainer(class) false end +function genie_footer() + ParsedHTMLString(""" + + + """) +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 "" @@ -507,6 +533,19 @@ 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")) +end + """ function theme() :: String @@ -528,20 +567,12 @@ julia> push!(Stipple.Layout.THEMES[], StippleUI.theme) function theme(; core_theme::Bool = true) :: Vector{String} output = String[] - if core_theme - push!(THEMES[], () -> begin - stylesheet("https://fonts.googleapis.com/css?family=Material+Icons"), - stylesheet(Genie.Assets.asset_path(Stipple.assets_config, :css, file="stipplecore")) - end - ) - end - - unique!(THEMES[]) + core_theme && coretheme ∉ THEMES[] && push!(output, coretheme()...) for f in THEMES[] push!(output, f()...) end - + output end diff --git a/src/ReactiveTools.jl b/src/ReactiveTools.jl index 1456a57a..33503752 100644 --- a/src/ReactiveTools.jl +++ b/src/ReactiveTools.jl @@ -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 -> """\n""", meta) """ @@ -73,7 +75,7 @@ function DEFAULT_LAYOUT(; title::String = "Genie App",