From 46997c261d2370d7612b5cbf8ac5c3523b4b5242 Mon Sep 17 00:00:00 2001 From: inhji Date: Wed, 29 Mar 2023 16:10:53 +0200 Subject: [PATCH 1/2] add hover state for home items --- lib/chiya_web/controllers/page_html/home.html.heex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chiya_web/controllers/page_html/home.html.heex b/lib/chiya_web/controllers/page_html/home.html.heex index 41d7a94..486b344 100644 --- a/lib/chiya_web/controllers/page_html/home.html.heex +++ b/lib/chiya_web/controllers/page_html/home.html.heex @@ -27,7 +27,7 @@ <%= if @channel do %>
<%= for note <- @channel.notes do %> - + <%= note.name %> <%= pretty_date(note.published_at) %> From c7c4f554f938b1b16de7c2d6b78eeabc3e5a93ee Mon Sep 17 00:00:00 2001 From: Inhji Date: Wed, 29 Mar 2023 18:47:45 +0200 Subject: [PATCH 2/2] add theming to public pages, make default theme dark/light --- assets/css/app.css | 23 +++++++++++++------ lib/chiya_web/components/admin_components.ex | 14 +++-------- lib/chiya_web/components/layouts.ex | 7 ------ .../components/layouts/root_public.html.heex | 9 +++++++- .../controllers/page_html/home.html.heex | 2 +- .../controllers/page_html/note.html.heex | 2 +- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/assets/css/app.css b/assets/css/app.css index 64d5953..5939420 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -6,13 +6,22 @@ @import "./lightbox.css"; @layer base { - :root { - --color-primary: 16 185 129; + :root[data-theme=default] { + --color-primary: 68 68 68; --color-background: 255 255 255; - --color-text-base: 82 82 91; - --color-text-heading: 24 24 27; - --color-text-muted: 82 82 91; - --color-text-dim: 244 244 245; + --color-text-base: 68 68 68; + --color-text-heading: 68 68 68; + --color-text-muted: 153 153 153; + --color-text-dim: 204 204 204; + } + + :root[data-theme=default][data-mode=dark] { + --color-primary: 255 255 255; + --color-background: 34 34 34; + --color-text-base: 204 204 204; + --color-text-heading: 255 255 255; + --color-text-muted: 102 102 102; + --color-text-dim: 68 68 68; } :root[data-theme=roguelight] { @@ -28,7 +37,7 @@ /* Invert prose styles based on the variant of the theme. */ -:root[data-variant=dark] .prose { +:root[data-mode=dark] .prose { @apply prose-invert; } diff --git a/lib/chiya_web/components/admin_components.ex b/lib/chiya_web/components/admin_components.ex index 2a8220d..5e86406 100644 --- a/lib/chiya_web/components/admin_components.ex +++ b/lib/chiya_web/components/admin_components.ex @@ -70,15 +70,6 @@ defmodule ChiyaWeb.AdminComponents do
  • <%= @current_user.email %>
  • -
  • - <.link - href="#" - id="dark-mode-toggle" - class="text-xs leading-6 text-gray-100 font-semibold hover:text-gray-300" - > - <.icon name="hero-sun-mini" class="h-4 w-4" /> - -
  • <.link href={~p"/user"} @@ -107,10 +98,11 @@ defmodule ChiyaWeb.AdminComponents do <% else %>
  • <.link - href={~p"/user/register"} + href="#" + id="dark-mode-toggle" class="text-xs leading-6 text-gray-100 font-semibold hover:text-gray-300" > - Register + <.icon name="hero-sun-mini" class="h-4 w-4" />
  • diff --git a/lib/chiya_web/components/layouts.ex b/lib/chiya_web/components/layouts.ex index 48692c0..a49bec1 100644 --- a/lib/chiya_web/components/layouts.ex +++ b/lib/chiya_web/components/layouts.ex @@ -2,11 +2,4 @@ defmodule ChiyaWeb.Layouts do use ChiyaWeb, :html embed_templates "layouts/*" - - @doc """ - Defines which themes are light and which are dark themes. - This influences the prose styles in app.css. - """ - def theme_variant(:default), do: "light" - def theme_variant(:roguelight), do: "dark" end diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex index c2d0e5a..7ec655d 100644 --- a/lib/chiya_web/components/layouts/root_public.html.heex +++ b/lib/chiya_web/components/layouts/root_public.html.heex @@ -1,5 +1,5 @@ - + @@ -13,6 +13,13 @@ + diff --git a/lib/chiya_web/controllers/page_html/home.html.heex b/lib/chiya_web/controllers/page_html/home.html.heex index 486b344..d4f14a7 100644 --- a/lib/chiya_web/controllers/page_html/home.html.heex +++ b/lib/chiya_web/controllers/page_html/home.html.heex @@ -1,6 +1,6 @@
    -

    +

    <%= @settings.title %>

    diff --git a/lib/chiya_web/controllers/page_html/note.html.heex b/lib/chiya_web/controllers/page_html/note.html.heex index aca5e79..fd8a8f6 100644 --- a/lib/chiya_web/controllers/page_html/note.html.heex +++ b/lib/chiya_web/controllers/page_html/note.html.heex @@ -1,5 +1,5 @@

    -

    <%= @note.name %>

    +

    <%= @note.name %>

    <%= pretty_date(@note.published_at) %>