{WIP} Bulma => Knacss (add album)

This commit is contained in:
Damien Broqua 2022-02-18 11:05:10 +01:00
parent 5b0f5a69c4
commit 21a184bf8d
7 changed files with 321 additions and 154 deletions

View file

@ -0,0 +1,16 @@
.ajouter-un-album {
span.item {
margin-right: 0.6rem;
&::after {
content: ",";
}
&:last-child {
margin-right: 0;
&::after {
content: "";
}
}
}
}

View file

@ -1,5 +1,15 @@
.field { .field {
padding-top: .6rem; padding-top: .6rem;
&.has-addons {
display: flex;
justify-content: flex-start;
.button {
margin-bottom: 0;
}
}
label { label {
font-weight: 800; font-weight: 800;
} }
@ -24,6 +34,8 @@
white-space: nowrap; white-space: nowrap;
border-width: 1px; border-width: 1px;
margin-bottom: .5rem; margin-bottom: .5rem;
background-color: #fff;
border-color: #dbdbdb;
&.is-danger { &.is-danger {
background-color: #f14668; background-color: #f14668;
@ -48,4 +60,14 @@
color: #fff; color: #fff;
} }
} }
&.is-primary {
background-color: #48c78e;
border-color: transparent;
color: #fff;
&:hover {
background-color: #3ec487;
}
}
} }

View file

@ -15,5 +15,6 @@ body {
a { a {
color: #485fc7; color: #485fc7;
cursor: pointer;
} }
} }

View file

@ -28,5 +28,8 @@
@import './global'; @import './global';
@import './navbar'; @import './navbar';
@import './forms'; @import './forms';
@import './table';
@import './modal';
@import './home'; @import './home';
@import './connexion'; @import './connexion';
@import './ajouter-un-album';

124
sass/modal.scss Normal file
View file

@ -0,0 +1,124 @@
.modal {
bottom: 0;
left: 0;
right: 0;
top: 0;
align-items: center;
display: none;
flex-direction: column;
justify-content: center;
overflow: hidden;
position: fixed;
z-index: 40;
&.is-visible {
display: flex;
}
.modal-background {
background-color: rgba(10,10,10,.86);
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
}
.modal-card {
position: relative;
width: 300px;
margin: 0 auto;
display: flex;
flex-direction: column;
max-height: calc(100vh - 40px);
overflow: hidden;
@include respond-to("small-up") {
width: 560px;
}
@include respond-to("medium-up") {
width: 980px;
}
@include respond-to("large-up") {
width: 1200;
}
header,
footer {
align-items: center;
background-color: #f5f5f5;
display: flex;
flex-shrink: 0;
justify-content: flex-start;
padding: 20px;
position: relative;
}
header {
border-bottom: 1px solid #dbdbdb;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
justify-content: space-between;
font-size: 1.5rem;
button {
user-select: none;
background-color: rgba(10,10,10,.2);
border: none;
border-radius: 9999px;
cursor: pointer;
pointer-events: auto;
display: inline-block;
flex-grow: 0;
flex-shrink: 0;
font-size: 0;
height: 20px;
max-height: 20px;
max-width: 20px;
min-height: 20px;
min-width: 20px;
outline: none;
position: relative;
width: 20px;
&::before,
&::after {
background-color: #fff;
content: "";
display: block;
left: 50%;
position: absolute;
top: 50%;
transform: translateX(-50%) translateY(-50%) rotate(45deg);
transform-origin: center center;
}
&::before {
height: 2px;
width: 50%;
}
&::after {
height: 50%;
width: 2px;
}
}
}
section {
background-color: #fff;
flex-grow: 1;
flex-shrink: 1;
overflow: auto;
padding: 20px;
}
footer {
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
border-top: 1px solid #dbdbdb;
.button:not(:last-child) {
margin-right: .5em;
}
}
}
}

24
sass/table.scss Normal file
View file

@ -0,0 +1,24 @@
table {
color: #363636;
th, td {
padding: .5em .75em;
border-bottom: 1px solid #dbdbdb;
}
th {
border-bottom-width: 2px;
}
tr:nth-child(2n) {
background-color: #fafafa;
}
tbody {
tr {
&:hover {
background-color: #f5f5f5;
}
}
}
}

View file

@ -1,75 +1,15 @@
<div class="container" id="app"> <section class="layout-maxed ajouter-un-album" id="app">
<form @submit="search"> <div class="modal" :class="{'is-visible': modalIsVisible}" id="addAlbum">
<div class="field has-addons">
<div class="control">
<input class="input" type="text" name="q" v-model="q" placeholder="Nom de l'album ou code barre (ex : Hybrid Theory">
</div>
<div class="control">
<button class="button is-link" :disabled="loading">
<span class="icon">
<i class="fas fa-search"></i>
</span>
</button>
</div>
</div>
</form>
<table class="table is-striped is-hoverable is-fullwidth">
<thead>
<tr>
<th>Pochette</th>
<th>Titre</th>
<th>Pays</th>
<th>Année</th>
<th>Format</th>
<th>Genres</th>
<th>Styles</th>
</tr>
</thead>
<tbody>
<tr v-if="loading">
<td colspan="7">
Chargement en cours…
</td>
</tr>
<tr v-for="item in items">
<td>
<img :src="item.thumb" :alt="item.title" style="max-width: 120px;"/>
</td>
<td>
<a @click="loadDetails(item.id)">{{ item.title }}</a>
<!-- <a :href="'/ajouter-un-album/' + item.id">{{ item.title }}</a> -->
</td>
<td>{{ item.year }}</td>
<td>{{ item.country }}</td>
<td>
<ul>
<li v-for="format in item.format">{{ format }}</li>
</ul>
</td>
<td>
<ul>
<li v-for="genre in item.genre">{{ genre }}</li>
</ul>
</td>
<td>
<ul>
<li v-for="style in item.style">{{ style }}</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="modal" :class="{'is-active': modalIsVisible}" id="addAlbum">
<div class="modal-background"></div> <div class="modal-background"></div>
<div class="modal-card"> <div class="modal-card">
<header class="modal-card-head"> <header>
<p class="modal-card-title">{{details.artists_sort}} - {{details.title}}</p> <div>{{details.artists_sort}} - {{details.title}}</div>
<button class="delete" aria-label="close" @click="toggleModal"></button> <button aria-label="close" @click="toggleModal"></button>
</header> </header>
<section class="modal-card-body"> <section>
<div class="columns is-mobile"> <div class="grid grid-cols-2 gap-16">
<div class="column is-12-mobile is-4-desktop"> <div>
<div class="has-text-centered"> <div class="text-center">
<img :src="details.thumb %>" alt="Miniature" /> <img :src="details.thumb %>" alt="Miniature" />
<hr /> <hr />
<img v-for="image in details.images" :src="image.uri150" alt="Miniature" style="max-width: 60px;" /> <img v-for="image in details.images" :src="image.uri150" alt="Miniature" style="max-width: 60px;" />
@ -79,101 +19,138 @@
<li v-for="track in details.tracklist">{{ track.title }} ({{track.duration}})</li> <li v-for="track in details.tracklist">{{ track.title }} ({{track.duration}})</li>
</ol> </ol>
</div> </div>
<div class="column is-12-mobile is-8-desktop"> <div>
<div class="column is-12"> <div class="grid grid-cols-2 gap-10">
<div class="columns is-mobile is-multiline"> <div>
<div class="column is-12-mobile is-6-desktop" v-for="genre in details.genres"> <strong>Genres</strong>
<div class="field"> <br />
<label class="label" for="company">Genre</label> <span class="item" v-for="genre in details.genres">{{genre}}</span>
<div class="control">
<input type="text" id="genres" name="genres" class="input" v-model="genre" disabled />
</div>
</div>
</div>
<div class="column is-12-mobile is-6-desktop" v-for="style in details.styles">
<div class="field">
<label class="label" for="company">Style</label>
<div class="control">
<input type="text" id="style" name="style" class="input" v-model="style" disabled />
</div>
</div>
</div>
</div> </div>
<hr /> <div>
<div class="columns is-mobile"> <strong>Styles</strong>
<div class="column is-12-mobile is-6-desktop"> <br />
<div class="field"> <span class="item" v-for="style in details.styles">{{style}}</span>
<label class="label" for="year">Année</label>
<div class="control">
<input type="text" id="year" name="year" class="input" v-model="details.year" disabled />
</div>
</div>
</div>
<div class="column is-12-mobile is-6-desktop">
<div class="field">
<label class="label" for="released">Date de sortie</label>
<div class="control">
<input type="text" id="released" name="released" class="input" v-model="details.released" disabled />
</div>
</div>
</div>
</div> </div>
<hr /> </div>
<div class="columns is-mobile"> <hr />
<div class="column is-12-mobile is-6-desktop"> <div class="grid grid-cols-3 gap-10">
<div class="field"> <div>
<label class="label" for="country">Pays</label> <strong>Pays</strong>
<div class="control"> <br />
<input type="text" id="country" name="country" class="input" v-model="details.country" disabled /> <span>{{details.country}}</span>
</div>
</div>
</div>
<div class="column is-12-mobile is-6-desktop" v-for="format in details.formats">
<div class="field">
<label class="label" for="format">Format</label>
<div class="control">
<input type="text" id="format" name="format" class="input" v-model="format.name" disabled />
</div>
</div>
</div>
</div> </div>
<hr /> <div>
<div class="columns is-mobile"> <strong>Année</strong>
<div class="column is-12-mobile is-6-desktop"> <br />
<span class="label">Codes barres</span> <span>{{details.year}}</span>
<ol> </div>
<li v-for="identifier in details.identifiers"> <div>
{{identifier.value}} ({{identifier.type}}) <strong>Date de sortie</strong>
</li> <br />
</ol> <span>{{details.released}}</span>
</div> </div>
<div class="column is-12-mobile is-6-desktop"> </div>
<span class="label">Label</span> <hr />
<div class="field" v-for="label in details.labels"> <div class="grid grid-cols-2 gap-10">
<div class="control"> <div>
<input type="text" name="label" class="input" v-model="label.name" disabled /> <strong>Format</strong>
</div> <br />
</div> <span v-for="format in details.formats">{{format.name}}</span>
<span class="label">Société</span> </div>
<div class="field" v-for="company in details.companies"> </div>
<div class="control"> <hr />
<input type="text" name="company" class="input" v-model="company.name" disabled /> <div class="grid grid-cols-2 gap-10">
</div> <div>
</div> <strong>Codes barres</strong>
</div> <ol>
<li v-for="identifier in details.identifiers">
{{identifier.value}} ({{identifier.type}})
</li>
</ol>
</div>
<div>
<strong>Label</strong>
<ol>
<li v-for="label in details.labels">
{{label.name}}
</li>
</ol>
<strong>Société</strong>
<ol>
<li v-for="company in details.companie">
{{company.name}}
</li>
</ol>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<footer class="modal-card-foot"> <footer>
<button class="button is-success" @click="add">Ajouter</button> <button class="button is-primary" @click="add">Ajouter</button>
<button class="button" @click="toggleModal">Annuler</button> <button class="button" @click="toggleModal">Annuler</button>
</footer> </footer>
</div> </div>
<button class="modal-close is-large" aria-label="close" @click="toggleModal"></button>
</div> </div>
</div> <div class="layout-hero">
<form @submit="search">
<div class="field has-addons">
<input type="text" name="q" v-model="q" placeholder="Nom de l'album ou code barre (ex : Hybrid Theory)">
<button class="button is-link" :disabled="loading">
<span class="icon">
<i class="fas fa-search"></i>
</span>
</button>
</div>
</form>
<table class="mt-20">
<thead>
<tr>
<th>Pochette</th>
<th>Titre</th>
<th>Pays</th>
<th>Année</th>
<th>Format</th>
<th>Genres</th>
<th>Styles</th>
</tr>
</thead>
<tbody>
<tr v-if="loading">
<td colspan="7">
Chargement en cours…
</td>
</tr>
<tr v-for="item in items">
<td>
<img :src="item.thumb" :alt="item.title" style="max-width: 120px;"/>
</td>
<td>
<a @click="loadDetails(item.id)">{{ item.title }}</a>
</td>
<td>{{ item.year }}</td>
<td>{{ item.country }}</td>
<td>
<ul>
<li v-for="format in item.format">{{ format }}</li>
</ul>
</td>
<td>
<ul>
<li v-for="genre in item.genre">{{ genre }}</li>
</ul>
</td>
<td>
<ul>
<li v-for="style in item.style">{{ style }}</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<script> <script>
Vue.createApp({ Vue.createApp({
data() { data() {