Skip to content

Commit e4267f5

Browse files
Change font and some alignment
1 parent 75ec817 commit e4267f5

File tree

6 files changed

+109
-11
lines changed

6 files changed

+109
-11
lines changed

css/dashboard.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,12 @@ button {
4949

5050
.edit {
5151
display: none!important;
52-
}
52+
}
53+
54+
.edit .edit{
55+
display: initial!important;
56+
}
57+
58+
.edit .noedit{
59+
display: none!important;
60+
}

css/style.css

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
@import url('https://fonts.googleapis.com/css?family=Merriweather');
2+
@import url('https://fonts.googleapis.com/css?family=Inconsolata');
3+
@import url('https://fonts.googleapis.com/css?family=Exo');
4+
15
body {
26
background-color: #f8f9fa;
7+
38
}
49

510
div.container-top{
@@ -22,10 +27,12 @@ div.flex{
2227
font-weight: 900;
2328
font-size: 2rem;
2429
margin-right: 70px;
30+
2531
}
2632

2733
p.explore {
2834
font-size: 1.3rem;
35+
font-family: 'PT Sans', sans-serif;
2936
}
3037
p.explore:hover {
3138
text-decoration: underline;
@@ -39,10 +46,15 @@ div.header-search {
3946
text-align: center;
4047
padding: 30px;
4148
padding-top: 10px;
42-
margin-top: 5rem;
49+
margin-top: 6rem;
4350
border-radius: 7px;
4451
box-shadow: 5px 5px white;
52+
font-family: 'Exo', sans-serif;
53+
font-size: 2rem;
54+
margin-bottom: 2rem
4555
}
56+
57+
4658
div.col > .form-control {
4759
border-radius: 20px;
4860
height: 50px;
@@ -77,6 +89,8 @@ div.load {
7789
background-color: #f8f9fa;
7890
padding-top: 30px;
7991
padding-bottom: 20px;
92+
font-family: 'PT Sans', sans-serif;
93+
margin-top: 3rem;
8094
}
8195
div.animal-category {
8296
display: flex;
@@ -103,11 +117,11 @@ div.middle-land, div.middle-sea {
103117
text-align: center;
104118
}
105119
div.middle-sea {
106-
top: 115%;
120+
top: 125%;
107121
left: 30%;
108122
}
109123
div.middle-land {
110-
top: 115%;
124+
top: 125%;
111125
left: 71%;
112126
}
113127
.land-animals:hover .land, .sea-animals:hover .sea {
@@ -133,6 +147,7 @@ p.text-overlay:hover {
133147
margin-left: auto;
134148
margin-right: auto;
135149
margin-top: 20px;
150+
font-family: 'PT Sans', sans-serif;
136151
}
137152

138153
.new-collection {
@@ -153,4 +168,29 @@ p.text-overlay:hover {
153168
.new-col:hover {
154169
background-color: rgb(248, 171, 28)!important;
155170
color: white!important;
171+
}
172+
173+
.admin-btn {
174+
height: 55px;
175+
margin-top: 15px;
176+
color: white;
177+
font-weight: 700;
178+
line-height: 1.5;
179+
}
180+
a.name {
181+
text-decoration: none;
182+
color: white;
183+
}
184+
a.name:hover {
185+
color: rgb(177, 168, 168);
186+
}
187+
footer {
188+
font-family: 'PT Sans', sans-serif;
189+
}
190+
#divAppend {
191+
font-family: 'Inconsolata', monospace;
192+
}
193+
.data-name {
194+
font-weight: 600;
195+
font-size: 30px;
156196
}

db.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"family": "Camelius",
88
"class": "Mammalia",
99
"category": "land",
10-
"external-link": "https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=33&cad=rja&uact=8&ved=2ahUKEwjHxMvo4NvgAhVStHEKHXrMBwoQmhMwIHoECAUQAg&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCamel&usg=AOvVaw0NjLn-kyh76RRgv2zYTDXG",
10+
"external": "https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=33&cad=rja&uact=8&ved=2ahUKEwjHxMvo4NvgAhVStHEKHXrMBwoQmhMwIHoECAUQAg&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCamel&usg=AOvVaw0NjLn-kyh76RRgv2zYTDXG",
1111
"image": "https://rangerrick.org/wp-content/uploads/2018/07/Camels-by-Roland-Seitre-Minden-1156x650.jpg",
1212
"info": "A camel is an even-toed ungulate in the genus Camelus that bears distinctive fatty deposits known as 'humps' on its back. Camels have long been domesticated and, as livestock, they provide food and textiles"
1313
},

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<body>
1414
<div class="container-top">
1515
<div class="flex">
16-
<p class="name">ZOOTOPIA</p>
17-
<p class="explore">ADMIN<span>/</span>SIGN-IN</p>
16+
<p class="name"><a href="./index.html" class="name">ZOOTOPIA</a> </p>
17+
<button type="button" class="btn btn-warning admin-btn">ADMIN<span>/</span>SIGN-IN</button>
1818

1919
</div>
2020
<div class="header-search">
@@ -76,7 +76,7 @@ <h3>What Would You Like to Learn About?</h3>
7676
</div>
7777
</div> -->
7878

79-
</div>
79+
</div>
8080
</div>
8181
</div>
8282

javascript/dashboard.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ $(document).ready(function() {
1616
let $divAppendEdit = $('#divAppendEdit');
1717

1818
function addAnimalAdmin(animal) {
19-
$divAppendEdit.append(`<div class="col-md-4">
19+
$divAppendEdit.append(`<div class="col-md-4" data-id=${animal.id}>
2020
<div class="card mb-4 box-shadow">
2121
<img class="card-img-top noedit" src=${animal.image} alt="Card image cap">
2222
<div class="card-body">
23-
<p class="card-text noedit">${animal.info}</p>
23+
<p class="card-text noedit info">${animal.info}</p>
2424
<input class="edit info" />
2525
<div class="d-flex justify-content-between align-items-center">
2626
<div class="btn-group">
@@ -73,6 +73,43 @@ $(document).ready(function() {
7373
}
7474
})
7575
})
76+
77+
//edit animal
78+
$divAppendEdit.delegate('.editButton','click', function(e) { //.delete has not been added to the page yet hence
79+
e.preventDefault();
80+
let $div = $(this).closest('div');
81+
$div.find('input.info').val($div.find('p.info').html() ) //same for oothers
82+
$div.addClass('edit');
83+
})
84+
85+
$divAppendEdit.delegate('.cancel','click', function(e) {
86+
e.preventDefault();
87+
$(this).closest('div').removeClass('edit');
88+
})
89+
90+
$divAppendEdit.delegate('.cancel','click', function(e) {
91+
e.preventDefault();
92+
let $div = $(this).closest('div');
93+
let animal = {
94+
info: $div.find('input.info').val()
95+
};
96+
97+
$.ajax({
98+
type: 'PUT',
99+
url: 'http://localhost:3000/animals/' + $div.attr('data-id'),
100+
data: animal,
101+
success: function(newAnimal) {
102+
$div.find('p.info').html(animal.info); //same for others
103+
104+
$div.removeClass('edit');
105+
},
106+
error: function(){
107+
alert('Error updating order')
108+
}
109+
})
110+
})
111+
112+
76113
})
77114

78115

javascript/main.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,29 @@ $(document).ready(() => {
5757
`
5858
*/
5959

60+
//limit character lenght
61+
function limitChar(string) {
62+
if (string.length > 150) {
63+
return string.substring(0, 150) + '.....';
64+
}
65+
66+
}
67+
6068
function addAnimal(animal) {
69+
6170
//<small class="text-muted">9 mins</small> and <button type="button" class="btn btn-sm btn-outline-secondary">Edit</button>
6271
$divAppend.append(`<div class="col-md-4">
6372
<div class="card mb-4 box-shadow">
6473
<img class="card-img-top" src=${animal.image} alt="Card image cap">
6574
<div class="card-body">
66-
<p class="card-text">${animal.info}</p>
75+
<p class="card-text data-name">${animal.name}</p>
76+
<p class="card-text">Info: ${limitChar(animal.info)}</p>
77+
<p class="card-text">Species: ${animal.species}</p>
78+
<p class="card-text">Class: ${animal.class}</p>
6779
<div class="d-flex justify-content-between align-items-center">
6880
<div class="btn-group">
6981
<button type="button" class="btn btn-sm btn-outline-secondary">View</button>
82+
<button type="button" class="btn btn-sm btn-outline-secondary external"><a href=${animal.external}>Link</a></button>
7083
</div>
7184
</div>
7285
</div>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy