-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stylize dogs#index page to match style
- Loading branch information
1 parent
044d9ad
commit 8fe7b8d
Showing
7 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,31 @@ | ||
class DogsController < ApplicationController | ||
|
||
def index | ||
@dogs = fetch_mock_dog_data | ||
end | ||
|
||
private | ||
|
||
# | ||
# Returns an array of mock dog data | ||
# @return [Array] | ||
def fetch_mock_dog_data | ||
names = [ "Bella", "Buddy", "Buster", "Cali", "Charlie", "Max", "Oliver", "Oscar", "Penny", "Riley", "Shadow", "Sophie", "Toby", "Tucker", "Winston" ] | ||
ages = [ 'Puppy', 'Adult', 'Senior' ] | ||
breeds = [ 'Labrador', 'Poodle', 'German Shepherd', 'Golden Retriever', 'Pug' ] | ||
weights = [ 'Small', 'Medium', 'Large' ] | ||
sexs = [ 'Male', 'Female' ] | ||
|
||
12.times.map do |i| | ||
name = names.sample | ||
age = ages.sample | ||
breed = breeds.sample | ||
weight = weights.sample | ||
sex = sexs.sample | ||
|
||
dog_photo = "https://placedog.net/500/280?id=#{rand(1..100)}" | ||
OpenStruct.new(image_src: dog_photo, name: name, age: age, breed: breed, weight: weight, sex: sex) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1 class='text-4xl'> <%= local_assigns[:text] %></h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class='text-xl text-gray-400'> | ||
<%= yield %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<div class='shadow-2xl w-[300px] flex-grow mx-2 my-2 p-6 bg-white'> | ||
<div class='h-62'> | ||
<%= image_tag dog.image_src, class: 'object-cover w-full h-[325px]' %> | ||
</div> | ||
|
||
<div class='text-center text-4xl font-bold uppercase my-2'> | ||
<%= dog.name %> | ||
</div> | ||
|
||
<div class='space-y-2'> | ||
<div class='flex'> | ||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Breed:</label> | ||
<div class='text-[15px] font-medium'><%= dog.breed %></div> | ||
</div> | ||
|
||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Age:</label> | ||
<div class='text-[15px] font-medium'><%= dog.age %></div> | ||
</div> | ||
</div> | ||
|
||
<div class='flex'> | ||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Sex:</label> | ||
<div class='text-[15px] font-medium'><%= dog.sex %></div> | ||
</div> | ||
|
||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Weight (lbs):</label> | ||
<div class='text-[15px] font-medium'><%= dog.weight %></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div> | ||
<%= render 'components/header', text: 'Fosterable Dogs' %> | ||
|
||
<%= render 'components/textbody' do %> | ||
<p> Thinking about fostering? These adorable dogs from local rescues need someone to foster them while they await their furever home. Click on a dog below to see more information about each dog. </p> | ||
<% end %> | ||
|
||
<div class='flex flex-wrap justify-center mt-6 content-between'> | ||
<% @dogs.each do |dog| %> | ||
<%= render 'dogs/dog', dog: dog %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ module.exports = { | |
theme: { | ||
extend: { | ||
colors: { | ||
'teal': '#4FADBE', | ||
'landing': '#13C2C2', | ||
} | ||
} | ||
|