Skip to content

Commit

Permalink
Layout tweaks add drops
Browse files Browse the repository at this point in the history
  • Loading branch information
hschne committed Dec 11, 2023
1 parent 94d6b4d commit 04cd4f4
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 111 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ end
gem 'inline_svg', '~> 1.9'

gem 'annotate', '~> 3.2'

gem "erb-formatter", "~> 0.6.0"
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ GEM
drb (2.2.0)
ruby2_keywords
ed25519 (1.3.0)
erb-formatter (0.6.0)
syntax_tree (~> 6.0)
erubi (1.12.0)
globalid (1.2.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -178,6 +180,7 @@ GEM
parser (3.2.2.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
psych (5.1.1.1)
stringio
puma (6.4.0)
Expand Down Expand Up @@ -258,6 +261,8 @@ GEM
stimulus-rails (1.3.0)
railties (>= 6.0.0)
stringio (3.1.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tailwindcss-rails (2.0.33-aarch64-linux)
railties (>= 6.0.0)
tailwindcss-rails (2.0.33-x86_64-linux)
Expand Down Expand Up @@ -293,6 +298,7 @@ DEPENDENCIES
annotate (~> 3.2)
bootsnap
debug
erb-formatter (~> 0.6.0)
importmap-rails
inline_svg (~> 1.9)
jbuilder
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/drops_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

class DropsController < ApplicationController
before_action :set_drop, only: %i[show edit update destroy]
layout 'drops'
before_action :set_drop, only: %i[show preview]

def show; end

Expand Down
11 changes: 11 additions & 0 deletions app/models/drop.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# frozen_string_literal: true

# == Schema Information
#
# Table name: drops
#
# id :integer not null, primary key
# expiry :datetime
# path :string
# remaining_uses :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Drop < ApplicationRecord
has_one_attached :data
end
4 changes: 2 additions & 2 deletions app/views/application/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</div>
</div>
</section>
<section id="how-it-works" class="container mx-auto p-8">
<section id="how-it-works" class="container mx-auto max-w-screen-xl">

<h2 class="text-3xl font-extrabold text-center text-red-500 sm:text-5xl mb-8">How It Works</h2>

Expand Down Expand Up @@ -153,7 +153,7 @@
</div>
</section>

<section id="how-it-works" class="container mx-auto p-8">
<section id="how-it-works" class="container mx-auto max-w-screen-xl p-8">
<h2 class="text-3xl font-extrabold text-center text-gray-900 mb-8 sm:text-5xl">FAQ</h2>

<details class="group [&_summary::-webkit-details-marker]:hidden" open>
Expand Down
28 changes: 17 additions & 11 deletions app/views/drops/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<%= form_with(model: drop, class: "contents") do |form| %>
<% if drop.errors.any? %>
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
<h2><%= pluralize(drop.errors.count, "error") %> prohibited this drop from being saved:</h2>
<div
id="error_explanation"
class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3"
>
<h2><%= pluralize(drop.errors.count, "error") %>
prohibited this drop from being saved:</h2>

<ul>
<% drop.errors.each do |error| %>
Expand All @@ -11,27 +15,29 @@
</div>
<% end %>

<div class="my-5">
<%= form.label :path %>
<%= form.text_field :path, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
</div>

<div class="my-5">
<%= form.label :data %>
<%= form.file_field :data, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
<%= form.file_field :data,
class:
"block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
</div>

<div class="my-5">
<%= form.label :expiry %>
<%= form.datetime_field :expiry, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
<%= form.datetime_field :expiry,
class:
"block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
</div>

<div class="my-5">
<%= form.label :remaining_uses %>
<%= form.number_field :remaining_uses, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
<%= form.number_field :remaining_uses,
class:
"block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
</div>

<div class="inline">
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
<%= form.submit class:
"rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
</div>
<% end %>
100 changes: 12 additions & 88 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
<header class="bg-white">
<div
class="
mx-auto flex h-16 max-w-screen-xl items-center justify-between px-4 sm:px-6
lg:px-8
mx-auto flex h-16 max-w-screen-xl items-center justify-between sm:px-6 lg:px-8
"
>
<a class=" flex flex-row gap-1 items-center text-red-600 " href="/">
Expand All @@ -43,97 +42,22 @@
</svg>
</a>
</div>

</header>
<main>
<%= yield %>
<main class="">
<%= content_for?(:drops) ? yield(:drops) : yield %>
</main>

<footer class="bg-white">
<div class="mx-auto max-w-screen-xl px-4 pb-8 pt-16 sm:px-6 lg:px-8 lg:pt-24">
<div class="text-center">
<h2 class="text-3xl font-extrabold text-gray-900 sm:text-5xl">Customise Your Product</h2>

<p class="mx-auto mt-4 max-w-sm text-gray-500">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Cum
maiores ipsum eos temporibus ea nihil.
</p>

<a
href="#"
class="
mt-8 inline-block rounded-full border border-red-600 px-12 py-3 text-sm
font-medium text-red-600 hover:bg-red-600 hover:text-white focus:outline-none
focus:ring active:bg-red-500
"
>
Get Started
</a>
</div>

<div
class="
mt-16 border-t border-gray-100 pt-8 sm:flex sm:items-center sm:justify-between
lg:mt-24
"
>
<ul class="flex flex-wrap justify-center gap-4 text-xs lg:justify-end">
<li>
<a href="#" class="text-gray-500 transition hover:opacity-75">
Terms & Conditions
</a>
</li>

<li>
<a href="#" class="text-gray-500 transition hover:opacity-75">
Privacy Policy
</a>
</li>

<li>
<a href="#" class="text-gray-500 transition hover:opacity-75">
Cookies
</a>
</li>
</ul>
<footer class="bg-gray-50">
<div class="mx-auto max-w-screen-xl py-8 sm:px-6 lg:px-8">
<div class="sm:flex sm:items-center sm:justify-between">
<div class="flex justify-center text-teal-600 sm:justify-start">

<ul class="mt-8 flex justify-center gap-6 sm:mt-0 lg:justify-end">
<li>
<a
href="/"
rel="noreferrer"
target="_blank"
class="text-gray-700 transition hover:opacity-75"
>
<span class="sr-only">Twitter</span>
<%= inline_svg_tag "logo.svg", class: "h-12 w-12 p-2" %>
</div>

<svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path
d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84"
/>
</svg>
</a>
</li>

<li>
<a
href="/"
rel="noreferrer"
target="_blank"
class="text-gray-700 transition hover:opacity-75"
>
<span class="sr-only">GitHub</span>

<svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path
fill-rule="evenodd"
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
clip-rule="evenodd"
/>
</svg>
</a>
</li>
</ul>
<p class="mt-4 text-center text-sm text-gray-500 lg:mt-0 lg:text-right">
Copyright &copy; 2022. All rights reserved.
</p>
</div>
</div>
</footer>
Expand Down
6 changes: 6 additions & 0 deletions app/views/layouts/drops.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% content_for :drops do %>
<section class="mx-auto max-w-screen-xl px-4 py-32 lg:flex lg:h-screen ">
<%= yield %>
</section>
<% end %>
<%= render template: "layouts/application" %>
25 changes: 16 additions & 9 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 04cd4f4

Please sign in to comment.