Skip to content

Commit

Permalink
feature | list-coins
Browse files Browse the repository at this point in the history
  • Loading branch information
luc0 committed Sep 19, 2021
1 parent fa6d1e5 commit e8a8697
Show file tree
Hide file tree
Showing 8 changed files with 489 additions and 21 deletions.
3 changes: 1 addition & 2 deletions app/Http/Controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

class IndexController extends Controller
{
public function index()
public function index($coin)
{
$coinRanking = new CoinRanking();

$range = request()->get('range');
$coin = request()->get('coin', 'BTC');

$response = $coinRanking->getCoinPriceHistory($range, $coin);

Expand Down
18 changes: 18 additions & 0 deletions app/Http/Controllers/ListCoinsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Http\Controllers;

use App\Support\CoinRanking;
use Inertia\Inertia;

class ListCoinsController extends Controller
{
public function index()
{
$coinRanking = new CoinRanking();

return Inertia::render('ListCoins', [
'coins' => $coinRanking->listCoins()
]);
}
}
7 changes: 7 additions & 0 deletions app/Support/CoinRanking.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ public function getCoinPriceHistory(?string $period = '1y', ?string $coin = 'BTC
);
}

public function listCoins(): array
{
$coins = $this->getCoins();

return $coins['data']['coins'];
}

public function getCoinsId(): array
{
$coins = $this->getCoins();
Expand Down
76 changes: 76 additions & 0 deletions public/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,17 @@ select {
.prose > :last-child {
margin-bottom: 0;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
.fixed {
position: fixed;
}
Expand Down Expand Up @@ -1118,6 +1129,10 @@ select {
margin-left: auto;
margin-right: auto;
}
.-my-2 {
margin-top: -0.5rem;
margin-bottom: -0.5rem;
}
.ml-3 {
margin-left: 0.75rem;
}
Expand Down Expand Up @@ -1193,12 +1208,18 @@ select {
.block {
display: block;
}
.inline-block {
display: inline-block;
}
.flex {
display: flex;
}
.inline-flex {
display: inline-flex;
}
.table {
display: table;
}
.grid {
display: grid;
}
Expand Down Expand Up @@ -1280,6 +1301,9 @@ select {
.min-w-0 {
min-width: 0px;
}
.min-w-full {
min-width: 100%;
}
.max-w-screen-xl {
max-width: 1280px;
}
Expand Down Expand Up @@ -1388,9 +1412,21 @@ select {
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
}
.divide-y > :not([hidden]) ~ :not([hidden]) {
--tw-divide-y-reverse: 0;
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
}
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
--tw-divide-opacity: 1;
border-color: rgba(229, 231, 235, var(--tw-divide-opacity));
}
.overflow-hidden {
overflow: hidden;
}
.overflow-x-auto {
overflow-x: auto;
}
.overflow-y-auto {
overflow-y: auto;
}
Expand All @@ -1402,6 +1438,9 @@ select {
text-overflow: ellipsis;
white-space: nowrap;
}
.whitespace-nowrap {
white-space: nowrap;
}
.rounded-md {
border-radius: 0.375rem;
}
Expand Down Expand Up @@ -1526,6 +1565,14 @@ select {
--tw-bg-opacity: 1;
background-color: rgba(229, 231, 235, var(--tw-bg-opacity));
}
.bg-green-100 {
--tw-bg-opacity: 1;
background-color: rgba(209, 250, 229, var(--tw-bg-opacity));
}
.bg-gray-300 {
--tw-bg-opacity: 1;
background-color: rgba(209, 213, 219, var(--tw-bg-opacity));
}
.bg-opacity-25 {
--tw-bg-opacity: 0.25;
}
Expand Down Expand Up @@ -1646,6 +1693,9 @@ select {
.text-right {
text-align: right;
}
.align-middle {
vertical-align: middle;
}
.font-sans {
font-family: Nunito, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
Expand Down Expand Up @@ -1771,6 +1821,18 @@ select {
--tw-text-opacity: 1;
color: rgba(209, 213, 219, var(--tw-text-opacity));
}
.text-green-800 {
--tw-text-opacity: 1;
color: rgba(6, 95, 70, var(--tw-text-opacity));
}
.text-red-800 {
--tw-text-opacity: 1;
color: rgba(153, 27, 27, var(--tw-text-opacity));
}
.text-black {
--tw-text-opacity: 1;
color: rgba(0, 0, 0, var(--tw-text-opacity));
}
.underline {
text-decoration: underline;
}
Expand Down Expand Up @@ -1896,6 +1958,10 @@ select {
--tw-bg-opacity: 1;
background-color: rgba(249, 250, 251, var(--tw-bg-opacity));
}
.hover\:bg-gray-200:hover {
--tw-bg-opacity: 1;
background-color: rgba(229, 231, 235, var(--tw-bg-opacity));
}
.hover\:bg-red-700:hover {
--tw-bg-opacity: 1;
background-color: rgba(185, 28, 28, var(--tw-bg-opacity));
Expand Down Expand Up @@ -2075,6 +2141,11 @@ select {
margin-bottom: -1px;
}

.sm\:-mx-6 {
margin-left: -1.5rem;
margin-right: -1.5rem;
}

.sm\:ml-3 {
margin-left: 0.75rem;
}
Expand Down Expand Up @@ -2292,6 +2363,11 @@ select {
grid-column: span 4 / span 4;
}

.lg\:-mx-8 {
margin-left: -2rem;
margin-right: -2rem;
}

.lg\:px-8 {
padding-left: 2rem;
padding-right: 2rem;
Expand Down
Loading

0 comments on commit e8a8697

Please sign in to comment.