Skip to content

Commit 501d81d

Browse files
authoredMar 12, 2023
🎨 Styling improvements (#189)
* Fix styling issues from latest PR (filter) * Organize components * Switch home-view to use Card component * PostPreview use Card component & cleanup * Cleanup PostFeed & NavBar styling * PostView uses Card component * Tag preview uses Card component (untested) * Contact page/form use Card component * Error layout use Card * Cleanup * Cleanup component imports (as much as possible) * Revert "Cleanup component imports (as much as possible)" This reverts commit f229ca6. Revert import changes (they don't work)"
1 parent fda8ea0 commit 501d81d

35 files changed

+271
-223
lines changed
 

‎nuxt.config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ export default {
3737

3838
// Auto import components: https://go.nuxtjs.dev/config-components
3939
components: [
40+
'~/components/cards',
4041
'~/components/development',
4142
'~/components/forms',
42-
'~/components/helpers',
4343
'~/components/misc',
4444
'~/components/navigation',
4545
'~/components/previews',
46-
'~/components/structural',
4746
'~/components/views',
4847
],
4948

‎src/components/cards/Card.vue

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<div class="bg-card-light dark:bg-card-dark m-6 p-4 md:p-6 flex flex-wrap md:flex-nowrap shadow-lg dark:shadow-shadow-dark hover:shadow-none hover:rounded motion-safe:animate-fade-in-fast transition">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'card',
10+
props: {
11+
content: {
12+
type: Object,
13+
default: undefined
14+
},
15+
}
16+
};
17+
</script>

‎src/components/helpers/Card.vue renamed to ‎src/components/cards/ContentCard.vue

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
<template>
2-
<div class="grow page-preview-card flex col-span-1 flex-col justify-between bg-card-light dark:bg-card-dark text-center p-6 w-full hover:rounded shadow-md dark:shadow-shadow-dark hover:shadow-none transition">
2+
<card class="grow page-preview-card flex m-0 col-span-1 flex-col justify-between text-center w-full">
33
<nuxt-content
44
:document="content"
55
class="w-full max-w-none prose prose:dark-invert dark:prose-invert leading-normal prose-code:before:content-none prose-code:after:content-none transition"
66
/>
7-
</div>
7+
</card>
88
</template>
99

1010
<script>
11+
import Card from '@/components/cards/Card.vue';
12+
1113
export default {
12-
name: 'basic-card',
14+
name: 'content-card',
15+
components: {
16+
Card,
17+
},
1318
props: {
1419
content: {
1520
type: Object,

‎src/components/forms/ContactForm.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div id="contact-form-card" class="bg-card-light dark:bg-card-dark m-6 p-6 shadow-md hover:shadow-none hover:rounded motion-safe:animate-fade-in transition">
2+
<card id="contact-form-card">
33
<div v-if="formSubmitted" class="flex min-h-80 motion-safe:animate-fade-in">
44
<div class="m-auto">
55
<p class="mb-4">
@@ -99,12 +99,17 @@
9999
</p>
100100
</div>
101101
</form>
102-
</div>
102+
</card>
103103
</template>
104104

105105
<script>
106+
import Card from '@/components/cards/Card.vue';
107+
106108
export default {
107109
name: 'contact-form',
110+
components: {
111+
Card,
112+
},
108113
data: () => ({
109114
emailAddress: process.env.NUXT_ENV_EMAIL_ADDRESS,
110115
name: undefined,
File renamed without changes.
File renamed without changes.

‎src/components/structural/FooterBar.vue renamed to ‎src/components/navigation/FooterBar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</template>
4343

4444
<script>
45-
import NavItem from '../navigation//NavItem.vue';
45+
import NavItem from './NavItem.vue';
4646
4747
export default {
4848
name: 'footer-bar',

‎src/components/structural/NavBar.vue renamed to ‎src/components/navigation/NavBar.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{{ content.signatureNavItem.title }}
1010
</nav-item>
1111

12-
<div class="justify-between">
12+
<div class="justify-between flex sm:flex-none flex-wrap">
1313
<nav-item
1414
v-for="item in content.navItems"
1515
:key="item.title"
@@ -24,7 +24,7 @@
2424
</template>
2525

2626
<script>
27-
import NavItem from '../navigation/NavItem.vue';
27+
import NavItem from './NavItem.vue';
2828
2929
export default {
3030
name: 'nav-bar',

‎src/components/previews/Post.vue

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div v-if="post" :class="`post-preview-card ${getCardStyle}`">
2+
<card v-if="post" :class="`post-preview-card ${getCardStyle}`">
33
<div :class="getImageContainerStyle" style="aspect-ratio: 1 / 1;">
44
<nuxt-link ref="feature-image" :to="`${currentRoute}/${post.slug}`" :class="`w-full h-full motion-safe:animate-blur-fade-in-slow`">
55
<img :src="image" class="object-cover w-full h-full" />
@@ -17,9 +17,9 @@
1717
</nuxt-link>
1818
</div>
1919
</div>
20-
</div>
20+
</card>
2121

22-
<div v-else ref="lazy-load-post-preview" :class="`post-preview-card ${getCardStyle}`">
22+
<card v-else ref="lazy-load-post-preview" :class="`post-preview-card ${getCardStyle}`">
2323
<div :class="getImageContainerStyle" style="aspect-ratio: 1 / 1;">
2424
<div class="bg-gray-500 object-cover w-full h-full" />
2525
</div>
@@ -31,12 +31,17 @@
3131
<div class="bg-gray-400 w-48 h-3 mb-2"/>
3232
<div class="bg-gray-300 w-24 h-3" />
3333
</div>
34-
</div>
34+
</card>
3535
</template>
3636

3737
<script>
38+
import Card from '@/components/cards/Card.vue';
39+
3840
export default {
3941
name: 'post-preview',
42+
components: {
43+
Card,
44+
},
4045
props: {
4146
post: {
4247
type: Object,
@@ -74,7 +79,7 @@ export default {
7479
};
7580
},
7681
getCardStyle() {
77-
let style = `bg-card-light dark:bg-card-dark m-6 p-6 hover:rounded shadow-md dark:shadow-shadow-dark hover:shadow-none motion-safe:animate-fade-in transition ${this.classes}`;
82+
let style = `${this.classes}`;
7883
7984
if (!this.post)
8085
style += ' motion-safe:animate-pulse';
@@ -85,7 +90,7 @@ export default {
8590
if (this.fullWidth) {
8691
style += ' md:col-span-2 md:flex';
8792
} else {
88-
style += ' md:col-span-1';
93+
style += ' md:col-span-1 md:flex-col';
8994
}
9095
9196
return style;

‎src/components/previews/Tag.vue

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<div
2+
<card
33
v-if="tag"
4-
class="tag-preview-card bg-card-light dark:bg-card-dark m-6 p-6 hover:rounded shadow-md dark:shadow-shadow-dark hover:shadow-none motion-safe:animate-fade-in transition"
4+
class="tag-preview-card"
55
>
66
<nuxt-link ref="title" :to="`/tags/${tag.slug}`" class="font-bold text-2xl hover:underline">
77
{{tag.title}}
@@ -51,8 +51,8 @@
5151
<div v-else>
5252
<p class="text-md">There are not currently any posts for this tag</p>
5353
</div>
54-
</div>
55-
<div v-else ref="lazy-load-tag-preview" class="motion-safe:animate-pulse tag-preview-card bg-card-light dark:bg-card-dark m-6 p-6 hover:rounded shadow-md dark:shadow-shadow-dark hover:shadow-none motion-safe:animate-fade-in transition">
54+
</card>
55+
<card v-else ref="lazy-load-tag-preview" class="motion-safe:animate-pulse tag-preview-card">
5656
<div class="bg-gray-500 dark:bg-white w-32 h-4 transition" />
5757
<div class="bg-gray-400 w-64 h-2 my-2"/>
5858
<br>
@@ -64,17 +64,18 @@
6464
:is-reversed="index % 2 === 0"
6565
:classes="`shadow-none p-0 m-0 md:p-4 md:m-4`"
6666
/>
67-
</div>
67+
</card>
6868
</template>
6969

7070
<script>
71-
import Divider from '@/components/helpers/Divider.vue';
71+
import Card from '@/components/cards/Card.vue';
72+
import Divider from '@/components/misc/Divider.vue';
7273
import PostPreview from '@/components/previews/Post.vue';
73-
import ToolTip from '@/components/helpers/ToolTip.vue';
74+
import ToolTip from '@/components/misc/ToolTip.vue';
7475
7576
export default {
7677
name: 'tag-preview',
77-
components: { Divider, PostPreview, ToolTip },
78+
components: { Card, Divider, PostPreview, ToolTip },
7879
props: {
7980
tag: {
8081
type: Object,

‎src/components/views/Home.vue

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<template>
22
<div class="max-w-screen-lg mx-auto">
3-
<div >
4-
<div id="introduction-card" class="bg-card-light dark:bg-card-dark m-6 p-4 flex flex-wrap md:flex-nowrap shadow-lg dark:shadow-shadow-dark hover:shadow-none hover:rounded motion-safe:animate-fade-in-fast transition">
5-
<div class="max-w-sm md:w-2/5 lg:w-1/3 mx-auto md:my-auto">
6-
<img :src="image" class="rounded-full motion-safe:animate-blur-fade-in-fast transition" alt="Headshot" />
7-
</div>
8-
<div class="w-full md:w-3/5 lg:w-2/3 m-4 xs:mb-12 md:mb-0">
9-
<nuxt-content
10-
:document="metadata"
11-
class="prose prose-a:underline hover:prose-a:no-underline prose-a:text-primary-light dark:prose-invert dark:prose-a:text-primary-dark leading-normal prose-code:before:content-none prose-code:after:content-none transition"
12-
/>
13-
</div>
14-
</div>
15-
</div>
3+
<card id="introduction-card" class="md:pt-3">
4+
<div class="max-w-sm md:w-2/5 lg:w-1/3 mx-auto md:my-auto">
5+
<img :src="image" class="rounded-full motion-safe:animate-blur-fade-in-fast transition" alt="Headshot" />
6+
</div>
7+
<div class="w-full md:w-3/5 lg:w-2/3 m-4 xs:mb-12 md:mb-0">
8+
<nuxt-content
9+
:document="metadata"
10+
class="prose prose-a:underline hover:prose-a:no-underline prose-a:text-primary-light dark:prose-invert dark:prose-a:text-primary-dark leading-normal prose-code:before:content-none prose-code:after:content-none transition"
11+
/>
12+
</div>
13+
</card>
1614

1715
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 m-6 max-w-screen-lg flex-wrap md:flex-nowrap">
18-
<basic-card
16+
<content-card
1917
v-for="(item, i) in content"
2018
:key="item.title"
2119
:content="item"
@@ -26,12 +24,14 @@
2624
</template>
2725

2826
<script>
29-
import BasicCard from '@/components/helpers/Card.vue';
27+
import Card from '@/components/cards/Card.vue';
28+
import ContentCard from '@/components/cards/ContentCard.vue';
3029
3130
export default {
3231
name: 'home-view',
3332
components: {
34-
BasicCard,
33+
Card,
34+
ContentCard,
3535
},
3636
props: {
3737
metadata: {

‎src/components/views/Post.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="max-w-screen-lg mx-auto">
3-
<div id="post-card" class="bg-card-light dark:bg-card-dark m-0 md:m-6 p-4 flex flex-wrap shadow-lg dark:shadow-shadow-dark hover:shadow-none hover:rounded motion-safe:animate-fade-in transition">
3+
<card id="post-card" class="m-0 md:m-6 p-4 flex flex-wrap">
44
<div class="w-full p-4">
55
<div v-if="!isEditing">
66
<p id="post-title" class="text-4xl md:text-5xl lg:text-6xl font-bold mb-2 !leading-tight">{{ content.title }}</p>
@@ -42,17 +42,19 @@
4242
@endEdit="isEditing = false"
4343
/>
4444
</div>
45-
</div>
45+
</card>
4646
</div>
4747
</template>
4848

4949
<script>
50-
import Divider from '@/components/helpers/Divider.vue';
50+
import Card from '@/components/cards/Card.vue';
51+
import Divider from '@/components/misc/Divider.vue';
5152
5253
export default {
5354
name: 'post-view',
5455
components: {
55-
Divider
56+
Card,
57+
Divider,
5658
},
5759
props: {
5860
dir: {

0 commit comments

Comments
 (0)
Please sign in to comment.