Skip to content

Commit

Permalink
Merge pull request #76
Browse files Browse the repository at this point in the history
* feat: Create Notion API and fetch data

* feat: Add load more behavior

* feat: WIP - Add query url support for cursor, pagesize and status

* feat: WIP - Add "reading" page

* feat: WIP - Add filters

* fix: Fix card image issue

* feat: Add readings sort

* chore(deps): Update deps
  • Loading branch information
botmaster authored Feb 2, 2024
1 parent c4de56a commit a972505
Show file tree
Hide file tree
Showing 31 changed files with 1,095 additions and 200 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# APIS
NUXT_PUBLIC_LASTFM_API_KEY=
NUXT_NOTION_API_PRIVATE_KEY=

# Used by NuxtSimpeSitemap
NUXT_PUBLIC_SITE_URL=

# Notion db id
NUXT_NOTION_DATABASE_ID=

# Define IDE.
LAUNCH_EDITOR=webstorm
2 changes: 1 addition & 1 deletion app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
gsap.registerPlugin(ScrollTrigger);
ScrollTrigger.defaults({ markers: process.env.NODE_ENV === 'development' });
// ScrollTrigger.defaults({ markers: process.env.NODE_ENV === 'development' });
const { t } = useI18n();
Expand Down
4 changes: 2 additions & 2 deletions assets/scss/abstracts/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ $colors: (
$color-primary: color.scale($color-blue, $lightness: -7%);
$color-secondary: $nord-8;
$color-accent: $color-green;
$color-neutral: $color-gray-600;
$color-neutral: $nord-3;


// Theme colors dark
$color-primary-dark: $nord-8;
$color-secondary-dark: $nord-11;
$color-accent-dark: $color-green;
$color-neutral-dark: $color-gray-600;
$color-neutral-dark: $nord-6;

// Darken and lighten amount
$darken-amount: -60%;
Expand Down
11 changes: 11 additions & 0 deletions assets/scss/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ button {
.fouc-hidden {
visibility: hidden;
}

// Vue transition
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
10 changes: 10 additions & 0 deletions assets/scss/base/_forms.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Select
select {
@apply block w-full rounded-md border-0 py-1.5 text-body-txt shadow-sm ring-1 ring-inset ring-polarnight-nord-3
focus:ring-2 focus:ring-inset focus:ring-accent sm:max-w-xs sm:text-sm sm:leading-6;
}

input[type="text"] {
@apply block w-full rounded-md border-0 py-1.5 text-body-txt shadow-sm ring-1 ring-inset ring-polarnight-nord-3
focus:ring-2 focus:ring-inset focus:ring-accent sm:max-w-xs sm:text-sm sm:leading-6;
}
1 change: 1 addition & 0 deletions assets/scss/base/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
@forward "base";
@forward "typography";
@forward "nuxt-content";
@forward "forms";
7 changes: 7 additions & 0 deletions assets/scss/base/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,10 @@ h6,
/*strong {
@apply font-rubik-bold;
}*/

// Flow
// -------------------------

.flow > *:where(:not(:first-child)) {
margin-top: 1em;
}
45 changes: 45 additions & 0 deletions assets/scss/components/_badge.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@


.badge {
@apply inline-flex items-center max-w-full px-[0.6em] py-[0.1em] rounded text-sm font-medium bg-[#E2EFFE] text-[#1D5695];

> span {
@apply block truncate;
}

&, &--is-default {
@apply bg-snowstorm-nord-4;
}

&--is-info {
@apply bg-info text-info-content;
}

&--is-danger {
@apply bg-danger text-danger-content;
}

&--is-warning {
@apply bg-warning text-warning-content;
}

&--is-success {
@apply bg-success text-success-content;
}

&--is-neutral {
@apply bg-neutral text-neutral-content;
}

&--is-small {
@apply text-xs;
}

&--is-medium {
@apply text-sm;
}

&--is-large {
@apply text-base;
}
}
1 change: 1 addition & 0 deletions assets/scss/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

@import "btn";
@import "wrapper-outline";
@import "badge";
7 changes: 7 additions & 0 deletions components/layout/TheHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const localePath = useLocalePath();
>
<Icon name="material-symbols:home" /><span class="sr-only">{{ t("navigation.home") }}</span>
</NuxtLink>
<NuxtLink
class="the-header__nav-item the-header__nav-link"
:to="localePath({ name: 'readings' })"
:title="t('navigation.reading')"
>
<Icon name="fluent:reading-mode-mobile-20-filled" /><span class="sr-only">{{ t("navigation.reading") }}</span>
</NuxtLink>
<NuxtLink
class="the-header__nav-item the-header__nav-link"
:to="localePath({ name: 'lab' })"
Expand Down
52 changes: 52 additions & 0 deletions components/shared/AppCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<script setup lang="ts">
// Typescript Props with default values
interface Props {
as?: string
}
const props = withDefaults(defineProps<Props>(), {
as: 'article',
});
</script>

<template>
<Component :is="props.as" class="card">
<figure v-if="$slots.image" class="card__img-wrapper">
<slot name="image" />
</figure>

<div class="card__body">
<slot />
</div>
<footer v-if="$slots.footer" class="card__footer">
<slot name="footer" />
</footer>
</Component>
</template>

<style scoped lang="scss">
.card {
@apply relative p-0 overflow-hidden flex flex-col bg-white dark:bg-polarnight-nord-0 rounded-lg
border-[1px] border-snowstorm-nord-4 dark:border-polarnight-nord-2;
&__img-wrapper {
@apply relative aspect-video bg-snowstorm-nord-4 dark:bg-polarnight-nord-3;
:slotted(img) {
@apply absolute inset-0 size-full object-cover;
}
}
&__body {
@apply flex-grow px-4 py-2.5;
}
&__title {
@apply font-body text-base font-bold capitalize leading-tight;
}
&__footer {
@apply px-4 py-2.5 text-sm text-muted-text;
}
}
</style>
6 changes: 3 additions & 3 deletions composables/useBubblesEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function useBubblesEffect(options: BubblesOptions = {}) {
const vwPercent = vw * 0.4;

const {
bubbleCount = 10,
bubbleCount = 2,
bubbleSizeMin = vwPercent * 0.35,
bubbleSizeMax = vwPercent,
bubbleColors = [
Expand All @@ -38,8 +38,8 @@ export function useBubblesEffect(options: BubblesOptions = {}) {
],
} = options;

const spawnBubbleX = (buubleWidth: number) => {
return gsap.utils.random(-buubleWidth, (bubblesContainer.value?.clientWidth || 0) - buubleWidth / 2);
const spawnBubbleX = (bubbleWidth: number) => {
return gsap.utils.random(-bubbleWidth, (bubblesContainer.value?.clientWidth || 0) - bubbleWidth / 2);
};

const createBubble = () => {
Expand Down
8 changes: 8 additions & 0 deletions content/en/readings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
coverTitle: Reading
coverSubtitle: List of articles to read
coverDescription: Like a to-do list, but for articles to be read.
description: Pascal Achard, senior frontend developer. Reading. List of articles to read.
---


8 changes: 8 additions & 0 deletions content/en/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
coverTitle: À lire
coverSubtitle: Liste d'articles à lire
coverDescription: ???
description: Pascal Achard, développeur frontend senior. Test. Liste d'articles à lire.
---


9 changes: 9 additions & 0 deletions content/fr/readings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
coverTitle: Lectures
coverSubtitle: Frontend, développement, design, etc.
coverDescription: Base de données d’articles collectés au fil du temps.
description: Pascal Achard, développeur frontend senior. Lecture. Liste d'articles à lire.
---


## Articles
8 changes: 8 additions & 0 deletions content/fr/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
coverTitle: À lire
coverSubtitle: Liste d'articles à lire
coverDescription: ???
description: Pascal Achard, développeur frontend senior. Test. Liste d'articles à lire.
---


24 changes: 24 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"go": "Go",
"goToPage": "Go to page",
"languages": "Language",
"loadMore": "Load more",
"no": "No",
"yes": "Yes"
},
Expand All @@ -18,6 +19,7 @@
"home": "Home page",
"lab": "Lab page",
"languageSelector": "Language selector",
"reading": "Reading page",
"themeSelector": "Theme selector"
},
"pages": {
Expand All @@ -29,6 +31,28 @@
"scrobbles": "Scrobbles",
"scrobblesHistory": "Listening history",
"tracksPerPage": "{n} tracks per page"
},
"readings": {
"articleList": "Article list",
"bdd": "Data base",
"filters": {
"pageSizes": "Articles by page",
"status": {
"all": "All",
"canceled": "Canceled",
"inProgress": "In Progress",
"read": "Read",
"toRead": "To read"
},
"statusLabel": "Status"
},
"sort": {
"createdTime": "Created Time",
"lastEditedTime": "Last edited time",
"name": "Name",
"score": "⭐️⭐️⭐️⭐️⭐️",
"sortLabel": "Sort by"
}
}
},
"theme": {
Expand Down
24 changes: 24 additions & 0 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"go": "Allez",
"goToPage": "Aller à la page",
"languages": "Langue",
"loadMore": "Charger la suite",
"no": "Non",
"yes": "Oui"
},
Expand All @@ -18,6 +19,7 @@
"home": "Page d'accueil",
"lab": "Page lab",
"languageSelector": "Sélecteur de langue",
"reading": "Page lecture",
"themeSelector": "Sélecteur de thème"
},
"pages": {
Expand All @@ -29,6 +31,28 @@
"scrobbles": "Scrobbles",
"scrobblesHistory": "Historique d'écoute",
"tracksPerPage": "{n} pistes par pages"
},
"readings": {
"articleList": "Liste des articles",
"bdd": "Base de données",
"filters": {
"pageSizes": "Articles par page",
"status": {
"all": "Tous",
"canceled": "Annulés",
"inProgress": "En cours",
"read": "Lus",
"toRead": "À lire"
},
"statusLabel": "Statut"
},
"sort": {
"createdTime": "Date de création",
"lastEditedTime": "Date de dernière édition",
"name": "Nom",
"score": "⭐️⭐️⭐️⭐️⭐️",
"sortLabel": "Trier par"
}
}
},
"theme": {
Expand Down
2 changes: 2 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ export default defineNuxtConfig({
},

runtimeConfig: {
notionApiKey: process.env.NUXT_NOTION_API_PRIVATE_KEY,
public: {
pkg: JSON.stringify(pkg),
siteUrl: process.env.NUXT_PUBLIC_SITE_URL || 'http://localhost:3000',
lastFmApiKey: process.env.NUXT_PUBLIC_LASTFM_API_KEY,
notionDatabaseId: process.env.NUXT_NOTION_DATABASE_ID,
},
},

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
"dependencies": {
"@fontsource/inter": "^5.0.16",
"@fontsource/rubik": "^5.0.18",
"@notionhq/client": "^2.2.14",
"@studio-freight/lenis": "^1.0.34",
"@vueuse/nuxt": "^10.7.2",
"@vueuse/router": "^10.7.2",
"gsap": "^3.12.5",
"splitting": "^1.0.6"
},
Expand All @@ -34,6 +36,7 @@
"@nuxtjs/i18n": "^8.0.1",
"@nuxtjs/sitemap": "^5.1.0",
"@nuxtjs/tailwindcss": "^6.11.2",
"@tailwindcss/forms": "^0.5.7",
"@types/node": "^20.11.16",
"@types/splitting": "^1.0.5",
"@types/uuid": "^9.0.8",
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ onUnmounted(() => {
<div class="page-index__cover">
<AppLoader class="!absolute inset-0 z-0 m-auto text-[58px]" />
<CoverComponent
:title="data?.coverTitle"
:title="data?.coverTitle ?? ''"
:subtitle="data?.coverSubtitle ?? ''"
:uptitle="data?.coverUpTitle ?? ''"
:info="data?.coverInfo"
Expand Down
Loading

0 comments on commit a972505

Please sign in to comment.