add tailwind css and home page scaffold

This commit is contained in:
Dylan Knutson
2023-04-01 23:27:40 +09:00
parent b33028eb6e
commit 091926f9be
14 changed files with 94 additions and 5 deletions

4
.gitignore vendored
View File

@@ -35,4 +35,6 @@
/config/master.key
/profiler/
/flamegraph.svg
/flamegraph.svg
/app/assets/builds/*
!/app/assets/builds/.keep

View File

@@ -110,3 +110,5 @@ group :production do
gem "rails_semantic_logger"
end
# gem "pg_party"
gem "tailwindcss-rails", "~> 2.0"

View File

@@ -293,6 +293,8 @@ GEM
stimulus-rails (1.2.1)
railties (>= 6.0.0)
table_print (1.5.7)
tailwindcss-rails (2.0.26)
railties (>= 6.0.0)
thor (1.2.1)
timeout (0.3.1)
turbo-rails (1.3.3)
@@ -366,6 +368,7 @@ DEPENDENCIES
sqlite3 (~> 1.4)
stimulus-rails
table_print
tailwindcss-rails (~> 2.0)
turbo-rails
tzinfo-data
web-console

2
Procfile.dev Normal file
View File

@@ -0,0 +1,2 @@
web: bin/rails server -p 3000
css: bin/rails tailwindcss:watch

0
app/assets/builds/.keep Normal file
View File

View File

@@ -2,3 +2,4 @@
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_tree ../builds

View File

@@ -0,0 +1,13 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
/*
@layer components {
.btn-primary {
@apply py-2 px-4 bg-blue-200;
}
}
*/

View File

@@ -0,0 +1,6 @@
class PagesController < ApplicationController
skip_before_action :validate_api_token, only: [:root]
def root
end
end

View File

@@ -1,6 +1,10 @@
class VpnOnlyRouteConstraint
def matches?(request)
# curtus IP on vpn
request.ip == "10.200.0.3" || request.ip == "127.0.0.1"
if Rails.env.development?
request.ip == "127.0.0.1" || request.ip == "::1"
else
# curtus IP on vpn
request.ip == "10.200.0.3" || request.ip == "127.0.0.1"
end
end
end

View File

@@ -5,11 +5,14 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
<%= yield :head %>
</head>
<body>
<%= yield %>
<body class="w-full mx-0">
<main class="mx-auto w-full">
<%= yield %>
</main>
</body>
</html>

View File

@@ -0,0 +1,20 @@
<div class="min-h-full">
<header class="bg-white shadow">
<div class="mx-auto max-w-5xl py-6 px-6 sm:px-8 flex items-baseline">
<h1 class="text-4xl sm:text-5xl font-bold text-gray-900">ReFurrer</h1>
<div class="flex-grow"></div>
<h2 class="text-1xl sm:text-2xl italic font-bold text-gray-500">
Furry Swiss Army Knife</h2>
</div>
</header>
<main>
<div class="mx-auto max-w-5xl py-6 px-6 sm:px-8">
<div class="mx-auto max-w-xl border-gray-800 rounded">
<input
class="rounded bg-gray-200 text-gray-900 w-full text-xl p-2 placeholder:italic"
placeholder="FurAffinity Username"
/>
</div>
</div>
</main>
</div>

8
bin/dev Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env sh
if ! gem list foreman -i --silent; then
echo "Installing foreman..."
gem install foreman
fi
exec foreman start -f Procfile.dev "$@"

View File

@@ -1,4 +1,6 @@
Rails.application.routes.draw do
root to: "pages#root"
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
namespace :api do
namespace :fa do

23
config/tailwind.config.js Normal file
View File

@@ -0,0 +1,23 @@
const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
content: [
'./public/*.html',
'./app/helpers/**/*.rb',
'./app/javascript/**/*.js',
'./app/views/**/*.{erb,haml,html,slim}'
],
theme: {
extend: {
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
},
},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/aspect-ratio'),
require('@tailwindcss/typography'),
require('@tailwindcss/container-queries'),
]
}