Giter VIP home page Giter VIP logo

compose-starter-for-media's Introduction

Hello World, I'm Kiiiyo

Welcome to my page!
I'm Takashi Kiyota, DesignEngineer from Ibaraki, Japan.

Where to find me

Github Twitter Medium Zenn

compose-starter-for-media's People

Contributors

kiiiyo avatar

Watchers

 avatar

compose-starter-for-media's Issues

キーワード検索で投稿一覧を取得の実装

Overview

キーワード検索で投稿一覧を取得の実装

TODOs

Feature

  • Algolia と疎通する
  • Algolia Apiを利用して指定ワードの投稿を取得する

UI

  • 検索ページの表示
    • ページコンポーネントの実装
    • スクリーンコンポーネントの実装
    • 検索キーワード入力フォームの実装
    • 検索結果コンポーネントの実装
    • ページネーションの実装

Reference

投稿一覧ページの実装

Overview

投稿一覧を表示するページの実装をする

TODOs

機能実装

  • APIから投稿データを一覧で取得する
  • ページネーションの実装

UI実装

  • 投稿一覧用コンポーネント
  • ページネーション用コンポーネント

投稿データを取得する

Overview

記事データをAPIから取得して画面に表示する

TODOs

  • contentfulパッケージのインストール
  • dotenv パッケージのインストール
  • .envファイルに以下のキーを設定
    • CONTENTFUL_SPACE_ID
    • CONTENTFUL_DELIVERY_ACCESS_TOKEN
    • CONTENTFUL_MANAGEMENT_API_ACCESS_TOKEN
  • contentful用のcodegenの設定
  • API Client を設定する
  • Domainに型を定義する
  • fetcherを定義する

Contentful側の設定

  • contentfulを利用した手順を記載する

Artifact

https://github.com/kiiiyo/compose-starter-for-media/wiki/Getting-started

Note

個別投稿ページの実装

Overview

個別投稿ページを実装する

TODOs

Feature

  • 個別データの取得

UI

  • ページの実装
  • コンポーネントの実装
    • テンプレートコンポーネントの定義
    • スクリーンコンポーネントの定義

投稿一覧にページネーションを実装

アイコンのコンポーネントの設定

Overview

Next.js 環境でアイコンをレンダリングで切るように設定する

Note

packageのインストール

  • yarn add @fortawesome/fontawesome-svg-core
  • yarn add @fortawesome/free-brands-svg-icons
  • yarn add @fortawesome/free-solid-svg-icons
  • yarn add @fortawesome/react-fontawesome

コンポーネントサンプル

import * as React from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { fab } from '@fortawesome/free-brands-svg-icons'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { findIconDefinition, library } from '@fortawesome/fontawesome-svg-core'
//import { IconName, IconSize } from '../../../../@types/fortawesome'

library.add(fab, fas)

export type IconSize =
  | 'xs'
  | 'lg'
  | 'sm'
  | '1x'
  | '2x'
  | '3x'
  | '4x'
  | '5x'
  | '6x'
  | '7x'
  | '8x'
  | '9x'
  | '10x'

export type IconName =
  | 'arrow-right'
  | 'arrow-left'
  | 'github'
  | 'twitter'
  | 'facebook-square'

type IconProps = {
  size?: IconSize
  prefix: 'fas' | 'fab'
  name: IconName
}

export const IconPresenter = (props: IconProps) => {
  const { name, prefix, size } = props
  return (
    <FontAwesomeIcon
      icon={findIconDefinition({ prefix, iconName: name })}
      size={size || 'sm'}
    />
  )
}

export const Icon: React.FC<IconProps> = ({ ...props }) => {
  return <IconPresenter {...props} />
}

レンダリング時一瞬大きくなる問題

// pages/_app.tsx

import '@fortawesome/fontawesome-svg-core/styles.css'


Reference

Next.js setup

Overview

Next.js のセットアップを行う

Artifact

https://starter-template-for-media.vercel.app/

Note

  • node version を14.15.0に固定
  • package.jsonに各モジュールをインストール
  • TypeScriptからビルドできるように設定
  • yarn dev が実行できることを確認
  • now を利用したCIサービスを設定

Reference形式の投稿を取得の実装

Overview

Reference形式の投稿データの取得を実装する

TODOs

  • 指定カテゴリーに関連する投稿一覧を取得する
  • 指定タグに関連する投稿一覧を取得する

投稿取得APIの実装

Overview

Next.js 側で取得APIを実装する

TODOs

  • page/api/posts の実装
  • page/api/posts/[slug] の実装
  • unit テストの実装

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.