diff --git a/app/assets/images/blob.svg b/app/assets/images/blob.svg index 04cabc6cd..7dfcb310b 100644 --- a/app/assets/images/blob.svg +++ b/app/assets/images/blob.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/app/assets/images/splat-1.svg b/app/assets/images/splat-1.svg deleted file mode 100644 index e2097e4f1..000000000 --- a/app/assets/images/splat-1.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/assets/stylesheets/animation.css b/app/assets/stylesheets/animation.css index 5025176fa..76f03901c 100644 --- a/app/assets/stylesheets/animation.css +++ b/app/assets/stylesheets/animation.css @@ -20,11 +20,11 @@ } @keyframes float-up-left { - 0% { transform: translate(10px, 40px); opacity: 0.1; } - 100% { transform: translate(0, 0); opacity: 1; } + 0% { transform: translate(10px, 20px); } + 100% { transform: translate(0, 0); } } -@keyframes float-up-right { - 0% { transform: translate(-10px, 50px); opacity: 0.1; } - 100% { transform: translate(0, 0); opacity: 1; } +@keyframes float-down-right { + 0% { transform: translate(-10px, -20px); } + 100% { transform: translate(0, 0); } } diff --git a/app/assets/stylesheets/splats.css b/app/assets/stylesheets/splats.css index 86f4747f2..57345c4d4 100644 --- a/app/assets/stylesheets/splats.css +++ b/app/assets/stylesheets/splats.css @@ -3,13 +3,11 @@ } .windshield { - background-color: var(--color-selected); - border-radius: 2em; + background-color: var(--color-bg); display: flex; flex-wrap: wrap; justify-content: center; margin-block: clamp(var(--block-space), 3%, calc(var(--block-space) * 2)); - padding-inline: clamp(var(--inline-space), 5%, calc(var(--inline-space) * 3)); > * { flex-shrink: 1; @@ -21,27 +19,35 @@ --splat-color: var(--color-ink); --splat-rotate: 20deg; + animation: float-up-left 400ms normal forwards ease-out; aspect-ratio: 1; block-size: var(--splat-size); - color: var(--color-ink-reversed); + color: var(--splat-color, currentColor); container-type: inline-size; display: grid; place-items: center; position: relative; + transition: all 0.2s ease; - .windshield & { - animation: float-up-left 400ms normal forwards ease-in-out; + &:nth-of-type(2n) { + animation-delay: 50ms; + animation: float-down-right 400ms normal forwards ease-out; + } - &:nth-of-type(2n) { - animation-delay: 50ms; - animation: float-up-right 400ms normal forwards ease-in-out; + &:nth-of-type(4n) { + animation-delay: 150ms; + } + + [data-turbo-preview] & { animation: none; } + + @media (hover: hover) { + .windshield &:hover { + scale: 1.1; + + .splat__svg { + transform: rotate(calc(var(--splat-rotate) + 10deg)); + } } - - &:nth-of-type(4n) { - animation-delay: 150ms; - } - - [data-turbo-preview] & { animation: none; } } > * { @@ -54,27 +60,28 @@ } .splat__link { - color: var(--color-ink-reversed); + content: ""; + inset: 0; + position: absolute; + z-index: -1; } .splat__svg { - fill: var(--splat-color); + fill: var(--color-bg); position: absolute; - scale: 1; + scale: 1.1; + stroke: var(--splat-color); + stroke-width: 1.1rem; transform: rotate(var(--splat-rotate)); + transition: all 200ms ease-out; z-index: -1; } .splat__bubble { - aspect-ratio: 1 / 0.96; background-color: var(--splat-color); - background-position: 0; - background-size: 100%; - block-size: 95%; - border: 4px solid var(--splat-color); + border: 0.3em solid var(--splat-color); border-radius: 50%; position: absolute; - transform: rotate(var(--splat-rotate)); z-index: -1; a { @@ -82,19 +89,24 @@ } &.splat__category { - inset: auto auto 3cqi 3cqi; + inset: auto auto 10cqi 0cqi; + & { - inset: auto auto -5cqi 26cqi; + inset: auto auto -2cqi 16cqi; + & { - inset: auto auto -5cqi 52cqi; + inset: auto auto -10cqi 32cqi; } } + + .windshield &:has(.splat__category--new) { + display: none; + } } &.splat__date { - inset: 10cqi 5cqi auto auto; + aspect-ratio: 1; + inset: 2cqi 2cqi auto auto; } &.splat__meta { @@ -105,29 +117,44 @@ font-size: 5cqi; font-weight: 800; line-height: 1; + max-inline-size: 18ch; padding: 1em; place-items: center; position: absolute; scale: 1; + text-overflow: ellipsis; transform: none; + transition: all 200ms ease-out; + white-space: nowrap; } - &.splat__category-new { - .windshield & { - display: none; + @media (hover: hover) { + .windshield .splat:hover & { + transform: translate(1rem, 1rem); + } + + .windshield .splat:hover & + & { + transform: translate(1rem, -1rem); + } + + .windshield .splat:hover & + & + & { + transform: translate(-1rem, -1rem); } } } .splat__title { - font-size: 10cqi; - line-height: 1.2; - margin: 12cqi 14cqi; - - -webkit-line-clamp: var(--lines, 3); + -webkit-line-clamp: var(--lines, 5); -webkit-box-orient: vertical; display: -webkit-box; + font-size: 8cqi; + hyphens: auto; + line-height: 1.2; + margin: auto; + max-block-size: 75cqi; + max-inline-size: 75cqi; overflow: hidden; + pointer-events: none; text-overflow: clip; white-space: normal; } @@ -135,7 +162,7 @@ .splats-list { --hover-size: 0; - a { + .splat__title-link { color: var(--color-txt); text-decoration: none; } @@ -144,7 +171,7 @@ border-radius: 0.6em; list-style: none; padding: 0.5em 1em; - transition: background-color 0.2s ease; + transition: background-color 200ms ease; &:hover{ background-color: var(--color-selected); diff --git a/app/models/splat.rb b/app/models/splat.rb index 46aea9375..fe132eae9 100644 --- a/app/models/splat.rb +++ b/app/models/splat.rb @@ -2,5 +2,5 @@ class Splat < ApplicationRecord has_many :categorizations has_many :categories, through: :categorizations, dependent: :destroy - enum :color, %w[ dodgerblue limegreen tomato mediumorchid ].index_by(&:itself), suffix: true, default: :dodgerblue + enum :color, %w[ dodgerblue teal tomato slateblue ].index_by(&:itself), suffix: true, default: :dodgerblue end diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index d9cdd3d79..61f7c0cf7 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -2,7 +2,7 @@ <% turbo_page_requires_reload %>
" style="--panel-size: 40ch;"> - <%= image_tag "splat-1.svg", class: "product__logo center colorize--black", size: 130 %> + <%= image_tag "blob.svg", class: "product__logo center colorize--black", size: 130 %>

Splat

<%= form_with model: User.new, url: session_path, class: "flex flex-column gap" do |form| %> diff --git a/app/views/splats/_splat.html.erb b/app/views/splats/_splat.html.erb index a71881729..cf7b99488 100644 --- a/app/views/splats/_splat.html.erb +++ b/app/views/splats/_splat.html.erb @@ -1,11 +1,13 @@ -
- - - +
+ + +

<%= splat.title %>

+ <%= link_to splat, class: "splat__link" do %> -

<%= splat.title %>

+ <%= splat.title %> <% end %> - + + <% splat.categories.each do | category | %> <%= link_to category.title, splats_path(category_id: category.id), class: "splat__bubble splat__meta splat__category" %> @@ -14,7 +16,7 @@ <% if splat.categories.count < 3 %> - <%= link_to "#", new_splat_category_path(splat) %> + <%= link_to "#", new_splat_category_path(splat), class: "splat__category--new" %> <% end %> diff --git a/app/views/splats/index.html.erb b/app/views/splats/index.html.erb index 5d2ee1663..6f60ef398 100644 --- a/app/views/splats/index.html.erb +++ b/app/views/splats/index.html.erb @@ -72,16 +72,12 @@
    <% @splats.each do | splat | %>
  • - <%= link_to splat, class: "flex align-center gap flex-item-grow" do %> -
    - - -
    + <%= link_to splat, class: "splat__title-link flex align-center gap flex-item-grow" do %> <%= splat.title %> <% end %> <% splat.categories.each do |category| %> - <%= link_to category.title, splats_path(category_id: category.id), class: "btn txt-small txt-nowrap" %> + <%= link_to "# #{ category.title }", splats_path(category_id: category.id) %> <% end %> JZ diff --git a/app/views/splats/show.html.erb b/app/views/splats/show.html.erb index ae9de856e..4d43e1716 100644 --- a/app/views/splats/show.html.erb +++ b/app/views/splats/show.html.erb @@ -20,7 +20,7 @@ <% end %> -
    +
    <%= render @splat %>
    diff --git a/test/fixtures/splats.yml b/test/fixtures/splats.yml index e2299fbd6..80cdd7c3f 100644 --- a/test/fixtures/splats.yml +++ b/test/fixtures/splats.yml @@ -13,4 +13,4 @@ two: three: title: The text is too small body: Increase the font size. - color: limegreen + color: teal