diff --git a/assets/css/app.css b/assets/css/app.css index d1d9858..cce8c3b 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -2,147 +2,83 @@ @import "tailwindcss/components"; @import "tailwindcss/utilities"; -@import "./reset.css"; -@import "./gruvbox.css"; @import "./lightbox.css"; @import "./tablesort.css"; +/* + The base layer is for things like reset rules or default styles applied to plain HTML elements. +*/ @layer base { :root { - --font-features: "case", "cpsp", "frac", "salt", "ccmp", "cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv09", "cv10", "cv11"; + --color-background: 255 255 255; + --color-foreground: 0 0 0; + --color-primary: 0 0 0; } - :root { + :root[mode=dark] { + --color-background: 0 0 0; + --color-foreground: 255 255 255; + --color-primary: 255 255 255; + } + + html { font-family: 'Inter', sans-serif; - font-feature-settings: var(--font-features); - } - @supports (font-variation-settings: normal) { - :root { - font-family: 'Inter var', sans-serif; - font-feature-settings: var(--font-features); - } + font-feature-settings: "case", "cpsp", "frac", "salt", "ccmp", "cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv09", "cv10", "cv11"; } - :root { - --color-primary: 214 93 14; /* orange */ - --color-primary1: 175 58 3; /* orange faded */ - - --color-secondary: 104 157 106; /* aqua */ - --color-secondary1: 66 123 88; /* aqua faded */ - - --color-blue: 69 133 136 ; /* blue */ - --color-blue1: 7 102 120; /* blue faded */ - - --color-purple: 177 98 134 ; /* purple */ - --color-purple1: 143 63 113; /* purple faded */ - - --color-yellow: 215 153 33; /* yellow */ - --color-yellow1: 181 118 20; /* yellow faded */ - - --color-background: 253 244 193; /* light0 */ - --color-background1: 235 219 178; /* light1 */ - - --color-foreground: 60 56 54; /* dark1 */ - --color-foreground1: 80 73 69; /* dark2 */ - - --color-heading: var(--color-secondary); - - @apply selection:bg-theme-primary/50; - } - - :root[data-mode=dark] { - --color-primary: 214 93 14; /* orange */ - --color-primary1: 254 128 25; /* orange bright */ - - --color-secondary: 104 157 106; /* aqua */ - --color-secondary1: 142 192 124; /* aqua bright */ - - --color-blue: 69 133 136 ; /* blue */ - --color-blue1: 131 165 152; /* blue bright */ - - --color-purple: 177 98 134 ; /* purple */ - --color-purple1: 250 189 47; /* purple bright */ - - --color-yellow: 215 153 33; /* yellow */ - --color-yellow1: 181 118 20; /* yellow bright */ - - --color-background: 40 40 40; /* dark0 */ - --color-background1: 60 56 54; /* dark1 */ - - --color-foreground: 235 219 178; /* light1 */ - --color-foreground1: 213 196 161; /* light2 */ - - --color-heading: var(--color-secondary); - } - - :root[data-mode=dark] .prose { - @apply prose-invert; - } - - .prose a, a.underline-link { - @apply underline decoration-1 decoration-theme-primary hover:decoration-theme-base transition; - } - - .prose a[href^="http://"], .prose a[href^="https://"] { - @apply after:content-['_↗'] - } - - .prose em { - @apply text-theme-quaternary; - } - - .prose h2 { @apply before:font-light before:text-theme-secondary; } - .prose h3 { @apply before:font-light before:text-theme-tertiary; } - .prose h4 { @apply before:font-light before:text-theme-quaternary; } - - - - .prose h1 { - @apply before:content-['#']; - } - - .prose h2 { - @apply before:content-['##']; - } - - .prose h3 { - @apply before:content-['###']; - } - - .prose h4 { - @apply before:content-['####']; - } - - .prose pre { - @apply p-0; - } - - .prose img { - @apply rounded-lg; + .stack > * + * { + margin-block-start: var(--flow-space, 1em); } } +/* + The components layer is for class-based styles that you want to be able to override with utilities. +*/ @layer components { - /* Set width and color for identity icons */ - a[rel] svg { - width: 1em; - fill: rgb(var(--color-foreground)); - } - - .alert { - @apply p-3 mt-3 rounded; + + #site-header { + @apply py-8 block px-3 bg-black text-white print:hidden; } - .alert.alert-danger { - @apply bg-red-100 text-red-500 dark:bg-red-950 dark:text-red-500; + #site-header nav ul { + @apply flex gap-3; } - .footnotes li p { display: inline; } - .footnotes hr { display: none; } - .footnote:before { content: '{'; } - .footnote:after { content: '}'; } - - a.button { - @apply inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold; + #site-content { + @apply grid grid-cols-1 lg:grid-cols-4 gap-3; } + + aside#primary-sidebar { + @apply col-span-1; + } + + aside#primary-sidebar nav { + @apply flex flex-col md:flex-row; + } + aside#primary-sidebar .menu { + @apply flex-1; + } + + aside#primary-sidebar .menu h2 { + @apply font-bold; + } + + aside#secondary-sidebar { + @apply col-span-1; + } + + section#content-wrapper { + @apply col-span-3; + } + + .divider { + @apply flex items-center my-8 before:flex-1 after:flex-1 before:content-[''] after:content-[''] before:p-[0.5px] after:p-[0.5px] w-full mx-auto last:hidden; + } +} + +/* + The utilities layer is for small, single-purpose classes that should always take precedence over any other styles. +*/ +@layer utilities { + } \ No newline at end of file diff --git a/assets/css/app.old.css b/assets/css/app.old.css new file mode 100644 index 0000000..d1d9858 --- /dev/null +++ b/assets/css/app.old.css @@ -0,0 +1,148 @@ +@import "tailwindcss/base"; +@import "tailwindcss/components"; +@import "tailwindcss/utilities"; + +@import "./reset.css"; +@import "./gruvbox.css"; +@import "./lightbox.css"; +@import "./tablesort.css"; + +@layer base { + :root { + --font-features: "case", "cpsp", "frac", "salt", "ccmp", "cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv09", "cv10", "cv11"; + } + + :root { + font-family: 'Inter', sans-serif; + font-feature-settings: var(--font-features); + } + @supports (font-variation-settings: normal) { + :root { + font-family: 'Inter var', sans-serif; + font-feature-settings: var(--font-features); + } + } + + :root { + --color-primary: 214 93 14; /* orange */ + --color-primary1: 175 58 3; /* orange faded */ + + --color-secondary: 104 157 106; /* aqua */ + --color-secondary1: 66 123 88; /* aqua faded */ + + --color-blue: 69 133 136 ; /* blue */ + --color-blue1: 7 102 120; /* blue faded */ + + --color-purple: 177 98 134 ; /* purple */ + --color-purple1: 143 63 113; /* purple faded */ + + --color-yellow: 215 153 33; /* yellow */ + --color-yellow1: 181 118 20; /* yellow faded */ + + --color-background: 253 244 193; /* light0 */ + --color-background1: 235 219 178; /* light1 */ + + --color-foreground: 60 56 54; /* dark1 */ + --color-foreground1: 80 73 69; /* dark2 */ + + --color-heading: var(--color-secondary); + + @apply selection:bg-theme-primary/50; + } + + :root[data-mode=dark] { + --color-primary: 214 93 14; /* orange */ + --color-primary1: 254 128 25; /* orange bright */ + + --color-secondary: 104 157 106; /* aqua */ + --color-secondary1: 142 192 124; /* aqua bright */ + + --color-blue: 69 133 136 ; /* blue */ + --color-blue1: 131 165 152; /* blue bright */ + + --color-purple: 177 98 134 ; /* purple */ + --color-purple1: 250 189 47; /* purple bright */ + + --color-yellow: 215 153 33; /* yellow */ + --color-yellow1: 181 118 20; /* yellow bright */ + + --color-background: 40 40 40; /* dark0 */ + --color-background1: 60 56 54; /* dark1 */ + + --color-foreground: 235 219 178; /* light1 */ + --color-foreground1: 213 196 161; /* light2 */ + + --color-heading: var(--color-secondary); + } + + :root[data-mode=dark] .prose { + @apply prose-invert; + } + + .prose a, a.underline-link { + @apply underline decoration-1 decoration-theme-primary hover:decoration-theme-base transition; + } + + .prose a[href^="http://"], .prose a[href^="https://"] { + @apply after:content-['_↗'] + } + + .prose em { + @apply text-theme-quaternary; + } + + .prose h2 { @apply before:font-light before:text-theme-secondary; } + .prose h3 { @apply before:font-light before:text-theme-tertiary; } + .prose h4 { @apply before:font-light before:text-theme-quaternary; } + + + + .prose h1 { + @apply before:content-['#']; + } + + .prose h2 { + @apply before:content-['##']; + } + + .prose h3 { + @apply before:content-['###']; + } + + .prose h4 { + @apply before:content-['####']; + } + + .prose pre { + @apply p-0; + } + + .prose img { + @apply rounded-lg; + } +} + +@layer components { + /* Set width and color for identity icons */ + a[rel] svg { + width: 1em; + fill: rgb(var(--color-foreground)); + } + + .alert { + @apply p-3 mt-3 rounded; + } + + .alert.alert-danger { + @apply bg-red-100 text-red-500 dark:bg-red-950 dark:text-red-500; + } + + .footnotes li p { display: inline; } + .footnotes hr { display: none; } + .footnote:before { content: '{'; } + .footnote:after { content: '}'; } + + a.button { + @apply inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold; + } +} \ No newline at end of file diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 52f36f0..bd0de9d 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -14,59 +14,7 @@ module.exports = { ], darkMode: ['class', '[data-mode="dark"]'], theme: { - extend: { - typography: { - gruvbox: { - css: { - '--tw-prose-td-borders': 'rgb(var(--color-background1))', - '--tw-prose-th-borders': 'rgb(var(--color-background1))', - '--tw-prose-body': 'rgb(var(--color-foreground))', - '--tw-prose-links': 'rgb(var(--color-foreground))', - '--tw-prose-headings': 'rgb(var(--color-foreground))', - '--tw-prose-bold': 'rgb(var(--color-yellow1))', - '--tw-prose-quotes': 'rgb(var(--color-foreground))', - '--tw-prose-bullets': 'rgb(var(--color-primary))', - '--tw-prose-code': 'rgb(var(--color-yellow1))', - '--tw-prose-pre-bg': 'rgb(var(--color-background1))', - '--tw-prose-quote-borders': 'rgb(var(--color-primary))', - '--tw-prose-counters': 'rgb(var(--color-foreground))', - '--tw-prose-invert-td-borders': 'rgb(var(--color-background1))', - '--tw-prose-invert-th-borders': 'rgb(var(--color-background1))', - '--tw-prose-invert-body': 'rgb(var(--color-foreground))', - '--tw-prose-invert-links': 'rgb(var(--color-foreground))', - '--tw-prose-invert-headings': 'rgb(var(--color-foreground))', - '--tw-prose-invert-bold': 'rgb(var(--color-yellow))', - '--tw-prose-invert-quotes': 'rgb(var(--color-foreground))', - '--tw-prose-invert-bullets': 'rgb(var(--color-primary))', - '--tw-prose-invert-quote-borders': 'rgb(var(--color-primary))', - '--tw-prose-invert-code': 'rgb(var(--color-yellow))', - '--tw-prose-invert-pre-bg': 'rgb(var(--color-background1))', - '--tw-prose-invert-counters': 'rgb(var(--color-foreground))', - } - } - }, - colors: { - code: colors.emerald, - gray: colors.zinc, - theme: { - background: 'rgb(var(--color-background) / )', - background1: 'rgb(var(--color-background1) / )', - base: 'rgb(var(--color-foreground) / )', - base1: 'rgb(var(--color-foreground1) / )', - primary: 'rgb(var(--color-primary) / )', - primary1: 'rgb(var(--color-primary1) / )', - secondary: 'rgb(var(--color-secondary) / )', - secondary1: 'rgb(var(--color-secondary1) / )', - tertiary: 'rgb(var(--color-blue) / )', - tertiary1: 'rgb(var(--color-blue1) / )', - quaternary: 'rgb(var(--color-purple) / )', - quaternary1: 'rgb(var(--color-purple1) / )', - quinary: 'rgb(var(--color-yellow) / )', - quinary1: 'rgb(var(--color-yellow1) / )', - heading: 'rgb(var(--color-heading) / )' - } - } - }, + container: { center: true } }, plugins: [ require("@tailwindcss/forms"), diff --git a/lib/chiya_web/components/layouts.ex b/lib/chiya_web/components/layouts.ex index 0c1e49d..a49bec1 100644 --- a/lib/chiya_web/components/layouts.ex +++ b/lib/chiya_web/components/layouts.ex @@ -1,7 +1,5 @@ defmodule ChiyaWeb.Layouts do use ChiyaWeb, :html - import ChiyaWeb.PublicComponents, only: [divider: 1, site_header: 1] - embed_templates "layouts/*" end diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex index ab002a2..4fa76a8 100644 --- a/lib/chiya_web/components/layouts/root_public.html.heex +++ b/lib/chiya_web/components/layouts/root_public.html.heex @@ -34,56 +34,96 @@ <%= @settings.custom_css %> - - - -
- <.site_header user={@current_user} /> + + -
- <%= @inner_content %> +
+ + +
+ <%= @inner_content %> +
-
-
-

Info

- -
    -
  • Served by Chiya v<%= Application.spec(:chiya, :vsn) %>
  • -
  • Made by Inhji
  • -
-
- -
-

Links

- - -
- -
-

Elsewhere

- - -
-
- -
- <.divider /> -
-
- -

+

Struggling to make a decent website since 2011

diff --git a/lib/chiya_web/components/public_components.ex b/lib/chiya_web/components/public_components.ex index 8e7bd0c..845e911 100644 --- a/lib/chiya_web/components/public_components.ex +++ b/lib/chiya_web/components/public_components.ex @@ -58,17 +58,7 @@ defmodule ChiyaWeb.PublicComponents do do: ~H"""
""" - - attr :text, :string, default: "⌘" - - def divider(assigns) do - ~H""" -
- <%= assigns.text %> -
- """ - end - + attr :note, :map, required: true attr :class_tag, :string, default: "" attr :linked, :boolean, default: true @@ -116,211 +106,7 @@ defmodule ChiyaWeb.PublicComponents do
""" end - - attr :layout, :atom, default: :list - attr :notes, :list, required: true - attr :show_content, :boolean, default: true - - def note_list(assigns) do - case assigns.layout do - :gallery -> - note_list_gallery(assigns) - - :microblog -> - note_list_microblog(assigns) - - _ -> - note_list_default(assigns) - end - end - - attr :notes, :list, required: true - - @doc """ - Default note list that renders a list of rounded boxes, - which show the note title and an excerpt of the content - """ - def note_list_default(assigns) do - ~H""" -
- <%= for note <- assigns.notes do %> - -
- - <%= note.name %> - - - <%= pretty_date(note.published_at) %> - -
- - <%= if assigns.show_content do %> -

- <%= String.slice(note.content, 0..150) %> -

- <% end %> - - <%= if not Enum.empty?(note.tags) do %> - - <.tags note={note} linked={false} /> - - <% end %> -
- <% end %> -
- """ - end - - attr :notes, :list, required: true - - def note_list_microblog(assigns) do - ~H""" -
- <%= for note <- assigns.notes do %> -
- <.featured_images note={note} /> - -
- <%= if(note.kind == :bookmark) do %> - <%= note.name %> - <% end %> -
- -
- <%= raw(render(note.content)) %> -
- - -
- - <.divider /> - <% end %> -
- """ - end - - attr :notes, :list, required: true - - def note_list_gallery(assigns) do - ~H""" - - """ - end - - attr :user, :map, required: true - - def site_header(assigns) do - ~H""" - - """ - end - + attr :note, :map, required: true def featured_images(assigns) do @@ -406,8 +192,6 @@ defmodule ChiyaWeb.PublicComponents do """ end - defp gallery_name(note), do: "gallery-#{note.id}" - defp main_images(note), do: Enum.filter(note.images, fn image -> image.featured end) end diff --git a/lib/chiya_web/controllers/page_html.ex b/lib/chiya_web/controllers/page_html.ex index cde8cf0..ed60d31 100644 --- a/lib/chiya_web/controllers/page_html.ex +++ b/lib/chiya_web/controllers/page_html.ex @@ -1,9 +1,14 @@ defmodule ChiyaWeb.PageHTML do use ChiyaWeb, :html_public import Phoenix.HTML.Tag, only: [content_tag: 3, content_tag: 2] + import ChiyaWeb.Format, only: [pretty_datetime: 1, pretty_date: 1, datetime: 1] embed_templates "page_html/*" + + attr :notes, :list, required: true + def note_list_default(assigns) + def tag_list([]), do: "No Tags" def tag_list(tags), do: Enum.map_join(tags, ", ", fn t -> t.name end) diff --git a/lib/chiya_web/controllers/page_html/bookmarks.html.heex b/lib/chiya_web/controllers/page_html/bookmarks.html.heex index 8f906db..0a48f56 100644 --- a/lib/chiya_web/controllers/page_html/bookmarks.html.heex +++ b/lib/chiya_web/controllers/page_html/bookmarks.html.heex @@ -8,7 +8,15 @@
- <.note_list notes={@notes} layout={@channel.layout} show_content={false} /> + <%= if @channel.layout == :default do %> + <.note_list_default notes={@channel.notes}/> + <% end %> + <%= if @channel.layout == :gallery do %> + <.note_list_gallery notes={@channel.notes}/> + <% end %> + <%= if @channel.layout == :microblog do %> + <.note_list_microblog notes={@channel.notes}/> + <% end %>
diff --git a/lib/chiya_web/controllers/page_html/channel.html.heex b/lib/chiya_web/controllers/page_html/channel.html.heex index 1ef075b..a2e7a08 100644 --- a/lib/chiya_web/controllers/page_html/channel.html.heex +++ b/lib/chiya_web/controllers/page_html/channel.html.heex @@ -5,6 +5,14 @@
- <.note_list notes={@channel.notes} layout={@channel.layout} /> + <%= if @channel.layout == :default do %> + <.note_list_default notes={@channel.notes}/> + <% end %> + <%= if @channel.layout == :gallery do %> + <.note_list_gallery notes={@channel.notes}/> + <% end %> + <%= if @channel.layout == :microblog do %> + <.note_list_microblog notes={@channel.notes}/> + <% end %>
diff --git a/lib/chiya_web/controllers/page_html/home.html.heex b/lib/chiya_web/controllers/page_html/home.html.heex index 0f57a06..139063c 100644 --- a/lib/chiya_web/controllers/page_html/home.html.heex +++ b/lib/chiya_web/controllers/page_html/home.html.heex @@ -1,29 +1,11 @@ -
- <.header class_title="text-theme-primary p-name" class_subtitle="p-summary"> - <%= @settings.title %> - <:subtitle><%= @settings.subtitle %> - - -
- -
- - <%= if @channel do %> -
- <.note_list notes={@channel.notes} layout={@channel.layout} /> -
+<%= if @channel do %> + <%= if @channel.layout == :default do %> + <.note_list_default notes={@channel.notes}/> <% end %> -
+ <%= if @channel.layout == :gallery do %> + <.note_list_gallery notes={@channel.notes}/> + <% end %> + <%= if @channel.layout == :microblog do %> + <.note_list_microblog notes={@channel.notes}/> + <% end %> +<% end %> diff --git a/lib/chiya_web/controllers/page_html/note.html.heex b/lib/chiya_web/controllers/page_html/note.html.heex index 3d37f90..92e6c51 100644 --- a/lib/chiya_web/controllers/page_html/note.html.heex +++ b/lib/chiya_web/controllers/page_html/note.html.heex @@ -34,8 +34,8 @@ <%= if not Enum.empty?(@note.links_to) do %>
- <.divider text="" /> Notes linking here: -
    + Notes linking here: +
      <%= for link <- @note.links_to do %>
    • <%= link.name %>
    • <% end %> @@ -45,7 +45,6 @@ <%= if String.length(@note.url || "") > 0 do %>
      - <.divider text=" " /> <.icon name="hero-link" /> <%= @note.url %>
      <% end %> @@ -77,8 +76,6 @@
      <%= if !Enum.empty?(@note.images) do %> - <.line /> -
      \ No newline at end of file diff --git a/lib/chiya_web/controllers/page_html/note_list_gallery.html.heex b/lib/chiya_web/controllers/page_html/note_list_gallery.html.heex new file mode 100644 index 0000000..9360fe0 --- /dev/null +++ b/lib/chiya_web/controllers/page_html/note_list_gallery.html.heex @@ -0,0 +1,30 @@ + + diff --git a/lib/chiya_web/controllers/page_html/note_list_microblog.html.heex b/lib/chiya_web/controllers/page_html/note_list_microblog.html.heex new file mode 100644 index 0000000..fa06198 --- /dev/null +++ b/lib/chiya_web/controllers/page_html/note_list_microblog.html.heex @@ -0,0 +1,29 @@ +
      + <%= for note <- assigns.notes do %> +
      + <.featured_images note={note} /> + +
      + <%= if(note.kind == :bookmark) do %> + <%= note.name %> + <% end %> +
      + +
      + <%= raw(Markdown.render(note.content)) %> +
      + + +
      + <% end %> +
      diff --git a/lib/chiya_web/controllers/page_html/tag.html.heex b/lib/chiya_web/controllers/page_html/tag.html.heex index 99c70b6..b17e5c8 100644 --- a/lib/chiya_web/controllers/page_html/tag.html.heex +++ b/lib/chiya_web/controllers/page_html/tag.html.heex @@ -5,6 +5,14 @@
      - <.note_list notes={@tag.notes} /> + <%= if @channel.layout == :default do %> + <.note_list_default note={@channel.notes}/> + <% end %> + <%= if @channel.layout == :gallery do %> + <.note_list_gallery note={@channel.notes}/> + <% end %> + <%= if @channel.layout == :microblog do %> + <.note_list_microblog note={@channel.notes}/> + <% end %>
diff --git a/lib/chiya_web/controllers/page_html/wiki.html.heex b/lib/chiya_web/controllers/page_html/wiki.html.heex index fb6f5b5..b9de616 100644 --- a/lib/chiya_web/controllers/page_html/wiki.html.heex +++ b/lib/chiya_web/controllers/page_html/wiki.html.heex @@ -14,13 +14,29 @@

Recently Updated

- <.note_list notes={@notes_updated} layout={@channel.layout} show_content={false} /> + <%= if @channel.layout == :default do %> + <.note_list_default note={@channel.notes}/> + <% end %> + <%= if @channel.layout == :gallery do %> + <.note_list_gallery note={@channel.notes}/> + <% end %> + <%= if @channel.layout == :microblog do %> + <.note_list_microblog note={@channel.notes}/> + <% end %>

Recently Published

- <.note_list notes={@notes_published} layout={@channel.layout} show_content={false} /> + <%= if @channel.layout == :default do %> + <.note_list_default note={@channel.notes}/> + <% end %> + <%= if @channel.layout == :gallery do %> + <.note_list_gallery note={@channel.notes}/> + <% end %> + <%= if @channel.layout == :microblog do %> + <.note_list_microblog note={@channel.notes}/> + <% end %>