Adds a mock of the dev tutorials

This commit is contained in:
Copple committed 2022-04-18 22:31:35 +02:00
1 parent 8b33597257
commit acb77219b2
11 files changed
+80 -11

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
{
"name": "web",
"name": "tutorials",
"version": "0.0.0",
"private": true,
"scripts": {
+1
View File
@@ -0,0 +1 @@
module.exports = require('config/postcss.config')
+22
View File
@@ -0,0 +1,22 @@
import { fetchPosts, DevPost } from '../utils/api'
export default function Tutorials({ posts }: { posts: DevPost[] }) {
return (
<div>
<h1>Tutorials</h1>
{posts.map((x) => (
<div>
<h2>{x.title}</h2>
<p>{x.description}</p>
</div>
))}
</div>
)
}
export async function getServerSideProps() {
const posts = await fetchPosts()
return {
props: { posts },
}
}
+55
View File
@@ -0,0 +1,55 @@
const username = 'supabase'
const postsUrl = `https://dev.to/api/articles?username=${username}`
// Defines a Post returned from the DEV API
export type DevPost = {
id: Number
title: string
description: string
slug: string
url: string
path: string
readable_publish_date: string
published_at: string
tags: string
tag_list: string[]
comments_count: Number
public_reactions_count: Number
positive_reactions_count: Number
published: boolean
first_published_at: string
edited_at: string
user: {
username: string
name: string
profile_image_90: string
cover_image_90: string
profile_image_original: string
cover_image_original: string
location: string
website: string
bio: string
twitter_username: string
github_username: string
dribbble_username: string
path: string
}
organization: {
id: Number
name: string
slug: string
profile_image_90: string
profile_imag: string
}
}
export async function fetchPosts() {
try {
const res = await fetch(postsUrl)
const data: DevPost[] = await res.json()
return data
} catch (err) {
console.log(err)
return []
}
}
+1
View File
@@ -0,0 +1 @@
module.exports = require('config/tailwind.config')
File renamed without changes.
-10
View File
@@ -1,10 +0,0 @@
import { Button } from "ui";
export default function Web() {
return (
<div>
<h1>Web</h1>
<Button />
</div>
);
}