-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05eb8f8
commit cbc1e01
Showing
37 changed files
with
2,264 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,6 @@ logs | |
.env | ||
.env.* | ||
!.env.example | ||
|
||
|
||
sw.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
### | ||
GET https://smartnation.id/wp-json/wp/v2/categories/148 | ||
GET http://localhost:3000/api/v1/articles | ||
|
||
### | ||
GET http://localhost:3000/api/categories | ||
|
||
### | ||
GET http://localhost:3000/api/posts | ||
GET http://localhost:3000/api/posts/smart-city-standar-nasional-indonesia-sni-untuk-kota-cerdas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<script lang="ts" setup> | ||
import { PostsDataType } from '~/utils/data/getInitialPostsData'; | ||
const props = defineProps({ | ||
limits: { type: Boolean }, | ||
limitsStart: { type: Number }, | ||
limitsEnd: { type: Number }, | ||
categoryId: { type: Number } | ||
}) | ||
const { data: posts } = await useFetch('/api/posts', { | ||
transform: (posts: PostsDataType) => { | ||
return props.limits ? posts.sort((a, b) => a.date_gmt.toString().localeCompare(b.date_gmt.toString())).slice(props.limitsStart, props.limitsEnd) | ||
: props.categoryId ? | ||
posts.filter(post => post.categories.find(categories => categories === props.categoryId)).sort((a, b) => a.date_gmt.toString().localeCompare(b.date_gmt.toString())).slice(props.limitsStart, props.limitsEnd) | ||
: posts.sort((a, b) => a.date_gmt.toString().localeCompare(b.date_gmt.toString())) | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="row justify-content-start g-3"> | ||
<div v-if="posts" v-for="post in posts" :key="post.id" class="col-xl-6 col-lg-6 col-md-6"> | ||
<div class="card border-0 rounded-0 mb-3"> | ||
<NuxtLink :to="`/${post.slug}`" :aria-label="`Baca Selengkapnya ${post.title.rendered}`"> | ||
<NuxtImg :class="'card-img-top img-fluid rounded'" :src="post.featured_media" :height="253" loading="lazy" | ||
:alt="post.title.rendered" /> | ||
</NuxtLink> | ||
<div class="card-body px-0 mx-0"> | ||
<div class="d-flex flex-wrap mb-2"> | ||
<span class="article-timestamp"> | ||
<BootstrapIcon name="clock" class="article-timestamp-icon" /> | ||
{{ useTimestamps(post.date_gmt) }} | ||
</span> | ||
</div> | ||
<NuxtLink :to="`/${post.slug}`" :aria-label="`Baca Selengkapnya ${post.title.rendered}`" | ||
:class="'card-title text-start lh-base link-offset-2 link-underline link-underline-opacity-0 article-title'"> | ||
{{ | ||
post.title.rendered.length >= 80 | ||
? `${post.title.rendered.substring(0, 80)}...` | ||
: post.title.rendered | ||
}} | ||
</NuxtLink> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="css" scoped> | ||
.card { | ||
background-color: transparent; | ||
} | ||
.article-title { | ||
color: #fff; | ||
font-family: Poppins; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 150%; | ||
transition: ease 300ms; | ||
} | ||
.article-title:hover { | ||
color: #d1d1d1; | ||
} | ||
.article-timestamp-icon { | ||
font-size: 12px; | ||
} | ||
.article-timestamp { | ||
color: var(--font-400, #fff); | ||
/* Font/Caption Reguler */ | ||
font-family: Poppins; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 120%; | ||
/* 12px */ | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.