Skip to content

Commit

Permalink
Improve mobile grid view
Browse files Browse the repository at this point in the history
  • Loading branch information
myieye committed Jun 11, 2024
1 parent 052a157 commit 1e967bb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 26 deletions.
53 changes: 27 additions & 26 deletions frontend/src/lib/components/ProjectList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,32 @@
export let projects: ProjectItemWithDraftStatus[];
</script>

<div class="grid grid-cols-2 sm:grid-cols-3 auto-rows-fr gap-2 md:gap-4">
<div class="grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-3 auto-rows-fr gap-2 md:gap-4 justify-items-center">
{#each projects as project}
{#if project.isDraft}
<div class="project draft">
<div data-sveltekit-preload-data="false" class="card aspect-square bg-base-200 shadow-base-300 group overflow-hidden">
<div class="bg" style="background-image: url('{getProjectTypeIcon(project.type)}')" />
<div class="card-body z-[1]">
<h2 class="card-title overflow-hidden text-ellipsis" title={project.name}>
<span class="text-primary inline-flex gap-2 items-center">
{project.name}
<span
class="tooltip text-warning text-xl shrink-0 leading-0"
data-tip={$t('projectlist.is_draft')}>
<Icon icon="i-mdi-script" />
</span>
<div data-sveltekit-preload-data="false" class="draft card aspect-square bg-base-200 shadow-base-300 group overflow-hidden">
<div class="bg" style="background-image: url('{getProjectTypeIcon(project.type)}')" />
<div class="card-body z-[1]">
<h2 class="card-title overflow-hidden text-ellipsis" title={project.name}>
<span class="text-primary inline-flex gap-2 items-center">
{project.name}
<span
class="tooltip text-warning text-xl shrink-0 leading-0"
data-tip={$t('projectlist.is_draft')}>
<Icon icon="i-mdi-script" />
</span>
</h2>
<p>{project.code}</p>
<Badge variant="badge-warning" outline>
<Icon icon="i-mdi-progress-clock" />
Awaiting approval
</Badge>
<p class="flex items-end">
{$t('projectlist.requested', {
requested: new Date(project.createdDate),
})}
</p>
</div>
</span>
</h2>
<p>{project.code}</p>
<Badge variant="badge-warning" outline>
<Icon icon="i-mdi-progress-clock" />
Awaiting approval
</Badge>
<p class="flex items-end">
{$t('projectlist.requested', {
requested: new Date(project.createdDate),
})}
</p>
</div>
</div>
{:else}
Expand Down Expand Up @@ -80,6 +78,9 @@
hover:border-neutral
hover:shadow-xl;
max-height: 50vh;
max-width: 100%;
.bg {
@apply absolute
w-full
Expand All @@ -104,7 +105,7 @@
}
}
.project.draft .card {
.draft.card {
pointer-events: none;
box-shadow: none;
}
Expand Down
6 changes: 6 additions & 0 deletions frontend/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { iconsPlugin, getIconCollections } = require('@egoist/tailwindcss-icons');
const defaultTheme = require('tailwindcss/defaultTheme');

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{svelte,ts}'],
Expand Down Expand Up @@ -31,6 +33,10 @@ module.exports = {
logs: false,
},
theme: {
screens: {
'xs': '475px',
...defaultTheme.screens,
},
extend: {
screens: {
'max-xs': { 'max': '400px' },
Expand Down

0 comments on commit 1e967bb

Please sign in to comment.