style: Refactor Vue pages and custom layout components to scoped BEM
This commit is contained in:
@@ -26,60 +26,58 @@ function submit() {
|
||||
<template>
|
||||
<Head title="Create Dynamic" />
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<div
|
||||
class="overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800"
|
||||
>
|
||||
<div class="p-6 text-gray-900 dark:text-gray-100">
|
||||
<h3 class="text-lg font-medium">Create a New Dynamic</h3>
|
||||
<div class="c-dynamics-create">
|
||||
<div class="c-dynamics-create__container">
|
||||
<div class="c-dynamics-create__card">
|
||||
<div class="c-dynamics-create__body">
|
||||
<h3 class="c-dynamics-create__title">Create a New Dynamic</h3>
|
||||
|
||||
<form @submit.prevent="submit" class="mt-6 space-y-6">
|
||||
<div>
|
||||
<form @submit.prevent="submit" class="c-dynamics-create__form">
|
||||
<div class="c-dynamics-create__field">
|
||||
<label
|
||||
for="name"
|
||||
class="block text-sm font-medium text-gray-700 dark:text-gray-300"
|
||||
class="c-dynamics-create__label"
|
||||
>Name</label
|
||||
>
|
||||
<input
|
||||
v-model="form.name"
|
||||
id="name"
|
||||
type="text"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:focus:border-indigo-600 dark:focus:ring-indigo-600"
|
||||
class="c-dynamics-create__input"
|
||||
/>
|
||||
<div
|
||||
v-if="form.errors.name"
|
||||
class="text-sm text-red-600"
|
||||
class="c-dynamics-create__error"
|
||||
>
|
||||
{{ form.errors.name }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="c-dynamics-create__field">
|
||||
<label
|
||||
for="rules"
|
||||
class="block text-sm font-medium text-gray-700 dark:text-gray-300"
|
||||
class="c-dynamics-create__label"
|
||||
>Rules</label
|
||||
>
|
||||
<textarea
|
||||
v-model="form.rules"
|
||||
id="rules"
|
||||
rows="4"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:focus:border-indigo-600 dark:focus:ring-indigo-600"
|
||||
class="c-dynamics-create__textarea"
|
||||
></textarea>
|
||||
<div
|
||||
v-if="form.errors.rules"
|
||||
class="text-sm text-red-600"
|
||||
class="c-dynamics-create__error"
|
||||
>
|
||||
{{ form.errors.rules }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="c-dynamics-create__actions">
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="form.processing"
|
||||
class="inline-flex items-center rounded-md border border-transparent bg-gray-800 px-4 py-2 text-xs font-semibold tracking-widest text-white uppercase transition duration-150 ease-in-out hover:bg-gray-700 focus:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-none active:bg-gray-900 dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-white dark:focus:bg-white dark:focus:ring-offset-gray-800 dark:active:bg-gray-300"
|
||||
class="c-dynamics-create__submit-btn"
|
||||
>
|
||||
Create
|
||||
</button>
|
||||
@@ -90,3 +88,59 @@ function submit() {
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "../../../css/app.css";
|
||||
|
||||
.c-dynamics-create {
|
||||
@apply py-12;
|
||||
}
|
||||
|
||||
.c-dynamics-create__container {
|
||||
@apply mx-auto max-w-7xl sm:px-6 lg:px-8;
|
||||
}
|
||||
|
||||
.c-dynamics-create__card {
|
||||
@apply overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800;
|
||||
}
|
||||
|
||||
.c-dynamics-create__body {
|
||||
@apply p-6 text-gray-900 dark:text-gray-100;
|
||||
}
|
||||
|
||||
.c-dynamics-create__title {
|
||||
@apply text-lg font-medium;
|
||||
}
|
||||
|
||||
.c-dynamics-create__form {
|
||||
@apply mt-6 space-y-6;
|
||||
}
|
||||
|
||||
.c-dynamics-create__field {
|
||||
@apply block;
|
||||
}
|
||||
|
||||
.c-dynamics-create__label {
|
||||
@apply block text-sm font-medium text-gray-700 dark:text-gray-300;
|
||||
}
|
||||
|
||||
.c-dynamics-create__input {
|
||||
@apply mt-1 block w-full rounded-md border border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:focus:border-indigo-600 dark:focus:ring-indigo-600;
|
||||
}
|
||||
|
||||
.c-dynamics-create__textarea {
|
||||
@apply mt-1 block w-full rounded-md border border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:focus:border-indigo-600 dark:focus:ring-indigo-600;
|
||||
}
|
||||
|
||||
.c-dynamics-create__error {
|
||||
@apply text-sm text-red-600;
|
||||
}
|
||||
|
||||
.c-dynamics-create__actions {
|
||||
@apply flex items-center gap-4;
|
||||
}
|
||||
|
||||
.c-dynamics-create__submit-btn {
|
||||
@apply inline-flex items-center rounded-md border border-transparent bg-gray-800 px-4 py-2 text-xs font-semibold tracking-widest text-white uppercase transition duration-150 ease-in-out hover:bg-gray-700 focus:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-none active:bg-gray-900 dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-white dark:focus:bg-white dark:focus:ring-offset-gray-800 dark:active:bg-gray-300;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -17,17 +17,15 @@ const breadcrumbs = [
|
||||
<template>
|
||||
<Head title="Dynamics" />
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<div
|
||||
class="overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800"
|
||||
>
|
||||
<div class="p-6 text-gray-900 dark:text-gray-100">
|
||||
<div class="mb-6 flex items-center justify-between">
|
||||
<h3 class="text-lg font-medium">Your Dynamics</h3>
|
||||
<div class="c-dynamics-index">
|
||||
<div class="c-dynamics-index__container">
|
||||
<div class="c-dynamics-index__card">
|
||||
<div class="c-dynamics-index__body">
|
||||
<div class="c-dynamics-index__header">
|
||||
<h3 class="c-dynamics-index__title">Your Dynamics</h3>
|
||||
<Link
|
||||
:href="route('dynamics.create')"
|
||||
class="inline-flex items-center rounded-md border border-transparent bg-gray-800 px-4 py-2 text-xs font-semibold tracking-widest text-white uppercase transition duration-150 ease-in-out hover:bg-gray-700 focus:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-none active:bg-gray-900 dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-white dark:focus:bg-white dark:focus:ring-offset-gray-800 dark:active:bg-gray-300"
|
||||
class="c-dynamics-index__button"
|
||||
>
|
||||
Create Dynamic
|
||||
</Link>
|
||||
@@ -35,30 +33,80 @@ const breadcrumbs = [
|
||||
|
||||
<div
|
||||
v-if="dynamics.length > 0"
|
||||
class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3"
|
||||
class="c-dynamics-index__grid"
|
||||
>
|
||||
<div
|
||||
v-for="dynamic in dynamics"
|
||||
:key="dynamic.id"
|
||||
class="border-b border-gray-200 bg-white p-6 dark:border-gray-600 dark:bg-gray-700"
|
||||
class="c-dynamics-index__item"
|
||||
>
|
||||
<Link :href="route('dynamics.show', dynamic.id)">
|
||||
<h4 class="text-lg font-semibold">
|
||||
<h4 class="c-dynamics-index__item-title">
|
||||
{{ dynamic.name }}
|
||||
</h4>
|
||||
</Link>
|
||||
<p
|
||||
class="mt-2 text-sm text-gray-600 dark:text-gray-400"
|
||||
>
|
||||
<p class="c-dynamics-index__item-desc">
|
||||
{{ dynamic.rules }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>You don't have any dynamics yet.</p>
|
||||
<p class="c-dynamics-index__empty">You don't have any dynamics yet.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "../../../css/app.css";
|
||||
|
||||
.c-dynamics-index {
|
||||
@apply py-12;
|
||||
}
|
||||
|
||||
.c-dynamics-index__container {
|
||||
@apply mx-auto max-w-7xl sm:px-6 lg:px-8;
|
||||
}
|
||||
|
||||
.c-dynamics-index__card {
|
||||
@apply overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800;
|
||||
}
|
||||
|
||||
.c-dynamics-index__body {
|
||||
@apply p-6 text-gray-900 dark:text-gray-100;
|
||||
}
|
||||
|
||||
.c-dynamics-index__header {
|
||||
@apply mb-6 flex items-center justify-between;
|
||||
}
|
||||
|
||||
.c-dynamics-index__title {
|
||||
@apply text-lg font-medium;
|
||||
}
|
||||
|
||||
.c-dynamics-index__button {
|
||||
@apply inline-flex items-center rounded-md border border-transparent bg-gray-800 px-4 py-2 text-xs font-semibold tracking-widest text-white uppercase transition duration-150 ease-in-out hover:bg-gray-700 focus:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-none active:bg-gray-900 dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-white dark:focus:bg-white dark:focus:ring-offset-gray-800 dark:active:bg-gray-300;
|
||||
}
|
||||
|
||||
.c-dynamics-index__grid {
|
||||
@apply grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3;
|
||||
}
|
||||
|
||||
.c-dynamics-index__item {
|
||||
@apply border-b border-gray-200 bg-white p-6 dark:border-gray-600 dark:bg-gray-700;
|
||||
}
|
||||
|
||||
.c-dynamics-index__item-title {
|
||||
@apply text-lg font-semibold;
|
||||
}
|
||||
|
||||
.c-dynamics-index__item-desc {
|
||||
@apply mt-2 text-sm text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
|
||||
.c-dynamics-index__empty {
|
||||
@apply text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -37,14 +37,12 @@ const breadcrumbs = [
|
||||
<template>
|
||||
<Head :title="dynamic.name" />
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<div
|
||||
class="overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800"
|
||||
>
|
||||
<div class="p-6 text-gray-900 dark:text-gray-100">
|
||||
<h3 class="text-lg font-medium">{{ dynamic.name }}</h3>
|
||||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
<div class="c-dynamic-show">
|
||||
<div class="c-dynamic-show__container">
|
||||
<div class="c-dynamic-show__card">
|
||||
<div class="c-dynamic-show__body">
|
||||
<h3 class="c-dynamic-show__title">{{ dynamic.name }}</h3>
|
||||
<p class="c-dynamic-show__rules">
|
||||
{{ dynamic.rules }}
|
||||
</p>
|
||||
</div>
|
||||
@@ -64,3 +62,31 @@ const breadcrumbs = [
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "../../../css/app.css";
|
||||
|
||||
.c-dynamic-show {
|
||||
@apply py-12;
|
||||
}
|
||||
|
||||
.c-dynamic-show__container {
|
||||
@apply mx-auto max-w-7xl sm:px-6 lg:px-8;
|
||||
}
|
||||
|
||||
.c-dynamic-show__card {
|
||||
@apply overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800;
|
||||
}
|
||||
|
||||
.c-dynamic-show__body {
|
||||
@apply p-6 text-gray-900 dark:text-gray-100;
|
||||
}
|
||||
|
||||
.c-dynamic-show__title {
|
||||
@apply text-lg font-medium;
|
||||
}
|
||||
|
||||
.c-dynamic-show__rules {
|
||||
@apply mt-2 text-sm text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -147,66 +147,60 @@ function isOwnerUser(userId: number): boolean {
|
||||
<Head :title="ledger.name" />
|
||||
|
||||
<!-- Floating Toast Notifications -->
|
||||
<div
|
||||
class="pointer-events-none fixed top-6 right-6 z-50 flex max-w-sm flex-col gap-3"
|
||||
>
|
||||
<div class="c-ledger-show__toast-container">
|
||||
<div
|
||||
v-for="toast in toasts"
|
||||
:key="toast.id"
|
||||
class="pointer-events-auto flex items-center justify-between gap-4 rounded-lg border border-neutral-700/50 bg-neutral-900 px-4 py-3 text-sm text-white shadow-xl"
|
||||
class="c-ledger-show__toast-item"
|
||||
>
|
||||
<span>{{ toast.message }}</span>
|
||||
<button
|
||||
@click="toasts = toasts.filter((t) => t.id !== toast.id)"
|
||||
class="cursor-pointer text-neutral-400 hover:text-white"
|
||||
class="c-ledger-show__toast-close-btn"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<div
|
||||
class="overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800"
|
||||
>
|
||||
<div class="p-6 text-gray-900 dark:text-gray-100">
|
||||
<h3 class="text-lg font-medium">{{ ledger.name }}</h3>
|
||||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
<div class="c-ledger-show">
|
||||
<div class="c-ledger-show__container">
|
||||
<div class="c-ledger-show__card">
|
||||
<div class="c-ledger-show__body">
|
||||
<h3 class="c-ledger-show__title">{{ ledger.name }}</h3>
|
||||
<p class="c-ledger-show__score">
|
||||
Score: {{ ledger.score }}
|
||||
</p>
|
||||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
<p class="c-ledger-show__rules">
|
||||
{{ ledger.rules }}
|
||||
</p>
|
||||
|
||||
<!-- Ledger Descriptive Media -->
|
||||
<div
|
||||
v-if="ledger.media && ledger.media.length > 0"
|
||||
class="mt-4 flex flex-wrap gap-3"
|
||||
class="c-ledger-show__media-list"
|
||||
>
|
||||
<div
|
||||
v-for="item in ledger.media"
|
||||
:key="item.id"
|
||||
class="max-w-[320px] overflow-hidden rounded-md border border-neutral-200 bg-black dark:border-neutral-700"
|
||||
class="c-ledger-show__media-item"
|
||||
>
|
||||
<img
|
||||
v-if="item.mime_type.startsWith('image/')"
|
||||
:src="item.url"
|
||||
class="h-auto max-h-[200px] w-full cursor-pointer object-cover transition-opacity hover:opacity-90"
|
||||
class="c-ledger-show__media-img"
|
||||
@click="openLightbox(item.url, item.mime_type)"
|
||||
/>
|
||||
<div
|
||||
v-else-if="item.mime_type.startsWith('video/')"
|
||||
class="relative cursor-pointer transition-opacity hover:opacity-90"
|
||||
class="c-ledger-show__media-video-wrapper"
|
||||
@click="openLightbox(item.url, item.mime_type)"
|
||||
>
|
||||
<video
|
||||
:src="item.url"
|
||||
class="h-auto max-h-[200px] w-full"
|
||||
class="c-ledger-show__media-video"
|
||||
></video>
|
||||
<div
|
||||
class="absolute inset-0 flex items-center justify-center bg-black/40 text-2xl font-bold text-white"
|
||||
>
|
||||
<div class="c-ledger-show__media-video-overlay">
|
||||
▶
|
||||
</div>
|
||||
</div>
|
||||
@@ -233,28 +227,116 @@ function isOwnerUser(userId: number): boolean {
|
||||
<!-- Lightbox Modal -->
|
||||
<div
|
||||
v-if="activeLightboxUrl"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-black/95 p-4"
|
||||
class="c-ledger-show__lightbox"
|
||||
@click="closeLightbox"
|
||||
>
|
||||
<button
|
||||
@click="closeLightbox"
|
||||
class="absolute top-6 right-6 cursor-pointer text-3xl text-white transition-colors duration-200 hover:text-red-500"
|
||||
class="c-ledger-show__lightbox-close"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
<div class="max-h-full max-w-full" @click.stop>
|
||||
<div class="c-ledger-show__lightbox-content" @click.stop>
|
||||
<img
|
||||
v-if="activeLightboxType === 'image'"
|
||||
:src="activeLightboxUrl"
|
||||
class="max-h-[90vh] max-w-full rounded object-contain shadow-lg"
|
||||
class="c-ledger-show__lightbox-img"
|
||||
/>
|
||||
<video
|
||||
v-else-if="activeLightboxType === 'video'"
|
||||
:src="activeLightboxUrl"
|
||||
controls
|
||||
autoplay
|
||||
class="max-h-[90vh] max-w-full rounded shadow-lg"
|
||||
class="c-ledger-show__lightbox-video"
|
||||
></video>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "../../../css/app.css";
|
||||
|
||||
.c-ledger-show__toast-container {
|
||||
@apply pointer-events-none fixed top-6 right-6 z-50 flex max-w-sm flex-col gap-3;
|
||||
}
|
||||
|
||||
.c-ledger-show__toast-item {
|
||||
@apply pointer-events-auto flex items-center justify-between gap-4 rounded-lg border border-neutral-700/50 bg-neutral-900 px-4 py-3 text-sm text-white shadow-xl;
|
||||
}
|
||||
|
||||
.c-ledger-show__toast-close-btn {
|
||||
@apply cursor-pointer text-neutral-400 hover:text-white;
|
||||
}
|
||||
|
||||
.c-ledger-show {
|
||||
@apply py-12;
|
||||
}
|
||||
|
||||
.c-ledger-show__container {
|
||||
@apply mx-auto max-w-7xl sm:px-6 lg:px-8;
|
||||
}
|
||||
|
||||
.c-ledger-show__card {
|
||||
@apply overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800;
|
||||
}
|
||||
|
||||
.c-ledger-show__body {
|
||||
@apply p-6 text-gray-900 dark:text-gray-100;
|
||||
}
|
||||
|
||||
.c-ledger-show__title {
|
||||
@apply text-lg font-medium;
|
||||
}
|
||||
|
||||
.c-ledger-show__score {
|
||||
@apply mt-2 text-sm text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
|
||||
.c-ledger-show__rules {
|
||||
@apply mt-2 text-sm text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
|
||||
.c-ledger-show__media-list {
|
||||
@apply mt-4 flex flex-wrap gap-3;
|
||||
}
|
||||
|
||||
.c-ledger-show__media-item {
|
||||
@apply max-w-[320px] overflow-hidden rounded-md border border-neutral-200 bg-black dark:border-neutral-700;
|
||||
}
|
||||
|
||||
.c-ledger-show__media-img {
|
||||
@apply h-auto max-h-[200px] w-full cursor-pointer object-cover transition-opacity hover:opacity-90;
|
||||
}
|
||||
|
||||
.c-ledger-show__media-video-wrapper {
|
||||
@apply relative cursor-pointer transition-opacity hover:opacity-90;
|
||||
}
|
||||
|
||||
.c-ledger-show__media-video {
|
||||
@apply h-auto max-h-[200px] w-full;
|
||||
}
|
||||
|
||||
.c-ledger-show__media-video-overlay {
|
||||
@apply absolute inset-0 flex items-center justify-center bg-black/40 text-2xl font-bold text-white;
|
||||
}
|
||||
|
||||
.c-ledger-show__lightbox {
|
||||
@apply fixed inset-0 z-50 flex items-center justify-center bg-black/95 p-4;
|
||||
}
|
||||
|
||||
.c-ledger-show__lightbox-close {
|
||||
@apply absolute top-6 right-6 cursor-pointer text-3xl text-white transition-colors duration-200 hover:text-red-500;
|
||||
}
|
||||
|
||||
.c-ledger-show__lightbox-content {
|
||||
@apply max-h-full max-w-full;
|
||||
}
|
||||
|
||||
.c-ledger-show__lightbox-img {
|
||||
@apply max-h-[90vh] max-w-full rounded object-contain shadow-lg;
|
||||
}
|
||||
|
||||
.c-ledger-show__lightbox-video {
|
||||
@apply max-h-[90vh] max-w-full rounded shadow-lg;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user