refact css tailwind

This commit is contained in:
2020-05-08 23:38:31 +02:00
parent 6e0db185bb
commit 765d99e48b
15 changed files with 194 additions and 106 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="flex justify-center items-center rounded-full bg-primary-600 hover:bg-primary-800">
<img v-if="avatar" src="avatar" alt="alt" class="avatar" v-bind:class="'avatar' + size">
<span v-else class="text-2xl font-bold" v-bind:class="'text-' + size">{{ alt[0] }}</span>
<div class="flex justify-center items-center rounded-full bg-gray-900 hover:bg-primary-800">
<img v-if="avatar" :src="avatar" alt="alt" class="rounded-full" v-bind:class="'avatar' + size">
<span v-else class="text-2xl font-bold text-gray-100 hover:text-white" v-bind:class="'text-' + size">{{ alt[0] }}</span>
</div>
</template>

View File

@@ -1,6 +1,6 @@
<template>
<nav v-bind:class="{ small: !toggleNav }" class="h-screen bg-primary-400 flex flex-col justify-between">
<div class="">
<nav v-bind:class="{ small: !toggleNav }" class="">
<div>
<router-link to="/" class="logo" v-bind:class="{ small: !toggleNav }">
<svg-vue icon="logo" />
</router-link>

View File

@@ -1,8 +1,8 @@
<template>
<div class="top-bar flex justify-between bg-primary-300">
<div class="top-bar flex justify-between bg-gray-600">
<router-link v-if="authUser" :to="'/profile'" class="flex items-center m-2">
<Avatar :avatar="authUser.data.attributes.avatar" size="small" :alt="authUser.data.attributes.name" class="w-10 h-10"/>
<span class="ml-2 hover:text-primary-900">{{ authUser.data.attributes.name }}</span>
<Avatar :avatar="authUser.data.attributes.profile_image.data.attributes.path" size="small" :alt="authUser.data.attributes.name" class="w-10 h-10"/>
<span class="ml-2 text-gray-100 hover:text-white">{{ authUser.data.attributes.name }}</span>
</router-link>
<form v-if="authUser && search" class="m-2">
<input type="search" name="search" placeholder="Search">
@@ -10,7 +10,7 @@
<svg-vue icon="search" />
</button>
</form>
<router-link to="/dashboard" v-if="authUser" class="text-primary-600 hover:text-primary-800">
<router-link to="/dashboard" v-if="authUser" class="text-gray-100 hover:text-white">
<svg-vue icon="params" class="w-10 m-2 fill-current" />
</router-link>
<router-link v-else to="/login">

View File

@@ -8,17 +8,26 @@
<h6>testeur CSS</h6>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
<p>Lorem ipsum dolor sit amet, <strong>consectetur adipiscing elit</strong>, sed do <italic>eiusmod tempor incididunt</italic> ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
<div class="py-1">
<div class="py-4">
<a href="#" class="btn">Boutton</a>
<a href="#" class="btn-primary">Boutton primary</a>
<a href="#" class="btn-secondary">Boutton secondary</a>
<a href="#" class="btn-alert">Boutton alert</a>
<a href="#" class="btn-success">Button success</a>
</div>
<div class="py-1">
<a href="#" class="btn">X</a>
<a href="#" class="btn-primary">X</a>
<a href="#" class="btn-secondary">X</a>
<a href="#" class="btn-alert">X</a>
<div class="py-4">
<a href="#" class="btn"><svg-vue icon="arrow" />Boutton</a>
<a href="#" class="btn-primary"><svg-vue icon="interrogation" />Boutton primary</a>
<a href="#" class="btn-secondary"><svg-vue icon="params" />Boutton secondary</a>
<a href="#" class="btn-alert"><svg-vue icon="close" />Boutton alert</a>
<a href="#" class="btn-success"><svg-vue icon="games" />Button success</a>
</div>
<div class="py-4">
<a href="#" class="btn svg"><svg-vue icon="close" /></a>
<a href="#" class="btn-primary svg"><svg-vue icon="close" /></a>
<a href="#" class="btn-secondary svg rounded-full"><svg-vue icon="close" /></a>
<a href="#" class="btn-alert svg"><svg-vue icon="close" /></a>
<a href="#" class="btn-success svg"><svg-vue icon="close" /></a>
</div>
<form>
<label class="mb-1">Test label</label>

View File

@@ -1,7 +1,9 @@
<template>
<router-link :to="link">
<div class="m-2 card">
<svg-vue icon="hangman" />
<div class="p-4">
<svg-vue icon="hangman" />
</div>
<h2>Pendu</h2>
</div>
</router-link>

View File

@@ -16,7 +16,7 @@
<h1 class="text-gray-700">{{ memo.data.name }}</h1>
</div>
<div class="flex justify-end py-2">
<span class="inline-block bg-primary-400 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2">{{ memo.data.last_updated }}</span>
<span class="inline-block bg-gray-400 text-white rounded-full px-3 py-1 text-sm font-semibold mr-2">{{ memo.data.last_updated }}</span>
</div>
</div>
</router-link>

View File

@@ -6,7 +6,7 @@
<div v-if="modal" class="modal">
<p class="m-2 text-center">Are you sure you want to delete this record ?</p>
<div class="flex justify-center mx-2 my-4">
<button class="btn-secondary mr-2" @click="modal = ! modal">Cancel</button>
<button class="btn mr-2" @click="modal = ! modal">Cancel</button>
<button class="btn-alert" @click="destroy"> Delete</button>
</div>
</div>
@@ -18,9 +18,9 @@
/>
<div class="absolute flex flex-col justify-between w-full top-0 bottom-0">
<div class="flex items-center justify-between p-4">
<router-link to="/memos/" class="btn-secondary">Back</router-link>
<router-link to="/memos/" class="btn">Back</router-link>
<div class="flex-middle">
<router-link :to="'/memos/' + memo.memo_id + '/edit'" class="btn-secondary mr-1" >Edit</router-link>
<router-link :to="'/memos/' + memo.memo_id + '/edit'" class="btn-primary mr-1" >Edit</router-link>
<a href="#" class="btn-alert" @click="modal = ! modal">Delete</a>
</div>
</div>
@@ -31,7 +31,7 @@
<div class="p-4">
<div class="memo-style rounded-t-sm p-4 pb-3 -mb-1 bg-white" v-html="memoMarkdown"></div>
<div class="bg-primary-400 rounded-b-sm px-2 py-1 flex justify-end">@last update {{ memo.last_updated }}</div>
<div class="bg-gray-400 text-white rounded-b-sm px-2 py-1 flex justify-end">@last update<span class="font-semibold ml-1">{{ memo.last_updated }}</span></div>
</div>
</div>
</div>

View File

@@ -3,9 +3,9 @@
<div v-if="modal" class="modal-container" @click="modal = ! modal"></div>
<div v-if="modal" class="modal px-2">
<p class="m-2 text-center">Add a new to-do list ?</p>
<InputField name="name" label="Title" placeholder="Your Title" required @update:field="name = $event" :errors="errors" />
<InputField name="name" label="Title" placeholder="Your Title" required @update:field="name = $event" :errors="errors" classes="border" />
<div class="flex justify-center mx-2 my-4">
<button class="btn-secondary mr-2" @click="modal = ! modal">Cancel</button>
<button class="btn mr-2" @click="modal = ! modal">Cancel</button>
<button class="btn-primary" @click="create">Create</button>
</div>
</div>
@@ -23,10 +23,10 @@
:to="'/to-do-lists/' + toDoList.data.to_do_list_id"
:to-do-list="toDoList"
class="w-full sm:w-1/2 md:w-1/3 lg:w-1/4" >
<div class="bg-primary-300 rounded text-black m-2 p-2">
<div class="bg-gray-300 rounded text-black m-2 p-2">
<div class="flex justify-between">
<span class="font-bold">{{ toDoList.data.attributes.data.name }}</span>
<span class="text-primary-900">
<span>
{{ toDoList.data.attributes.data.to_dos.to_dos_count_check }} / {{ toDoList.data.attributes.data.to_dos.to_dos_count }}
</span>
</div>

View File

@@ -4,15 +4,15 @@
<div v-if="modal" class="modal">
<p class="m-2 text-center">Are you sure you want to delete this list ?</p>
<div class="flex justify-center mx-2 my-4">
<button class="btn-secondary mr-2" @click="modal = ! modal">Cancel</button>
<button class="btn mr-2" @click="modal = ! modal">Cancel</button>
<button class="btn-alert" @click="destroy"> Delete</button>
</div>
</div>
<div class="flex items-center justify-between pb-2">
<router-link to="/to-do-lists/" class="btn-secondary">Back</router-link>
<router-link to="/to-do-lists/" class="btn">Back</router-link>
<a href="#" class="btn-alert" @click="modal = ! modal">Delete</a>
</div>
<div v-if="!loading" class="bg-primary-400 rounded p-1">
<div v-if="!loading" class="bg-gray-400 rounded p-1">
<h1 class="mb-2 ml-2 todo" >
<span v-if="!listNameEdit" class="text-2xl font-bold flex items-center">{{ toDoList.data.attributes.data.name }}
<span @click="listNameEdit = !listNameEdit">

View File

@@ -2,7 +2,7 @@
@tailwind base;
@tailwind components;
@import "components/base";
@import "components/elements";
@import "components/btn";
@import "components/nav";
@@ -11,5 +11,6 @@
@import "pages/memos";
@tailwind utilities;

32
resources/sass/components/_base.scss vendored Normal file
View File

@@ -0,0 +1,32 @@
.text-shadow {
text-shadow: 1px 1px 2px #000;
}
.left-8 {
left: 2rem;
}
.left-80 {
left: 20rem;
}
.-bottom-12 {
bottom: -3rem;
}
.max-h-64 {
max-height: 16rem;
}
.max-w-64 {
max-width: 16rem;
}
.max-h-48 {
max-height: 12rem;
}
.max-w-48 {
max-width: 12rem;
}

View File

@@ -1,40 +1,57 @@
// Button
.btn {
@apply border bg-primary-400 text-white py-2 px-4 shadow-sm rounded-md cursor-pointer;
@apply border border-transparent bg-gray-600 text-white font-semibold py-2 px-4 shadow-sm rounded cursor-pointer;
&:hover {
@apply text-white bg-primary-600 transition-all duration-300;
@apply text-white bg-gray-800 transition-all duration-300;
}
svg {
@apply w-4 fill-current mr-2 inline;
}
&.svg {
@apply px-2;
svg {
@apply mr-0;
}
}
}
.btn-primary {
@extend .btn;
@apply bg-primary-600;
@apply bg-blue-600 border-blue-600;
&:hover {
@apply bg-primary-800;
@apply bg-blue-800;
}
}
.btn-secondary {
@extend .btn;
@apply bg-primary-600;
@apply bg-blue-400;
&:hover {
@apply bg-primary-800;
@apply bg-blue-600;
}
}
.btn-alert {
@extend .btn;
@apply bg-red-600 text-white;
@apply bg-red border-red;
&:hover {
@apply bg-red-800;
@apply bg-red-dark;
}
}
.btn-success {
@extend .btn;
@apply bg-green border-green;
&:hover {
@apply bg-green-dark;
}
}

View File

@@ -1,57 +1,37 @@
// Elements
.text-shadow {
text-shadow: 1px 1px 2px #000;
}
.left-8 {
left: 2rem;
}
.left-80 {
left: 20rem;
}
.-bottom-12 {
bottom: -3rem;
}
.max-h-64 {
max-height: 16rem;
}
@for $i from 1 through 9 {
.bg-primary-#{$i}00 {
@apply bg-green-#{$i}00;
}
.hover:bg-primary-#{$i}00 {
@apply bg-green-#{$i}00;
}
.bg-secondary-#{$i}00 {
@apply bg-blue-#{$i}00;
}
.text-primary-#{$i}00 {
@apply text-gray-#{$i}00;
}
.hover:text-primary-#{$i}00 {
@apply text-gray-#{$i}00;
}
}
//@for $i from 1 through 9 {
//
// .bg-primary-#{$i}00 {
// @apply bg-green-#{$i}00;
// }
//
// .hover:bg-primary-#{$i}00 {
// @apply bg-green-#{$i}00;
// }
//
// .bg-secondary-#{$i}00 {
// @apply bg-blue-#{$i}00;
// }
//
// .text-primary-#{$i}00 {
// @apply text-gray-#{$i}00;
// }
//
// .hover:text-primary-#{$i}00 {
// @apply text-gray-#{$i}00;
// }
//}
.page-title {
@apply text-3xl font-bold text-primary-900;
@apply text-3xl font-bold text-gray-900;
}
a {
@apply text-primary-700;
@apply text-gray-700;
&:hover {
@apply text-primary-900;
@apply text-gray-900;
}
}
@@ -73,10 +53,10 @@ a {
@apply shadow;
&-header {
@apply flex justify-between items-center px-4 py-2 rounded bg-primary-400 font-bold cursor-pointer;
@apply flex justify-between items-center px-4 py-2 text-white bg-gray-800 font-bold cursor-pointer;
svg {
@apply w-8 text-primary-600 fill-current;
@apply w-8 fill-current;
}
}
@@ -91,15 +71,15 @@ a {
}
&-content {
@apply px-4 py-2;
@apply px-4 py-2 bg-white;
}
}
.card {
@apply bg-primary-300 rounded;
@apply bg-gray-300 rounded text-black;
svg {
@apply max-w-full max-h-64 m-auto fill-current;
@apply max-w-full max-h-48 max-w-48 m-auto fill-current;
}
h2 {
@@ -107,10 +87,10 @@ a {
}
&:hover {
@apply bg-primary-500;
@apply bg-gray-500 text-gray-700;
h2 {
@apply text-primary-700;
@apply text-gray-700;
}
}
}

View File

@@ -1,14 +1,14 @@
nav {
@apply w-48;
@apply w-48 h-screen bg-gray-800 flex flex-col justify-between shadow;
transition: width 0.3s;
svg {
@apply fill-current text-primary-600 w-12 p-2;
@apply fill-current text-gray-300 w-12 p-2;
transition: color 0.3s;
&:hover {
@apply text-primary-800;
@apply text-white;
}
}
@@ -22,24 +22,24 @@ nav {
}
.nav-item {
@apply flex items-center;
@apply flex items-center text-gray-100;
transition: background-color 0.3s;
span {
@apply font-bold text-xl ml-2 overflow-hidden truncate;
transition: width 0.3s;
&:hover {
@apply text-primary-800;
@apply text-white;
}
}
&:hover {
@apply bg-primary-500;
@apply bg-gray-900;
span,
svg {
@apply text-primary-800;
@apply text-white;
}
}
}

63
tailwind.config.js vendored
View File

@@ -1,11 +1,58 @@
module.exports = {
theme: {
extend: {
width: {
'96': '24rem'
}
theme: {
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
},
extend: {
colors: {
cyan: '#9cdbff',
green: {
light: '#333',
default: '#15a200',
dark: '#055b0c',
},
blue: {
100: '#E6E6FF',
200: '#BFBFFF',
300: '#9999FF',
400: '#4D4DFF',
500: '#0000FF',
600: '#0000E6',
700: '#000099',
800: '#000073',
900: '#00004D',
},
red: {
light: '#ff2626',
default: '#E60000',
dark: '#730000',
},
gray: {
100: '#f5f5f5',
200: '#eeeeee',
300: '#e0e0e0',
400: '#bdbdbd',
500: '#A0AEC0',
600: '#757575',
700: '#616161',
800: '#424242',
900: '#212121',
},
},
spacing: {
'12': '3rem',
'64': '16rem',
'96': '24rem',
'128': '32rem',
},
width: {
'96': '24rem'
}
},
},
},
variants: {},
plugins: [],
variants: {},
plugins: [],
}