Skip to content

Instantly share code, notes, and snippets.

View YounglanHong's full-sized avatar
🙏
Focused

YounglanHong

🙏
Focused
View GitHub Profile
@YounglanHong
YounglanHong / css-100-bytes.css
Last active November 1, 2021 10:35
100 Bytes of CSS to look great everywhere
// ref: https://www.swyx.io/css-100-bytes/
html {
max-width: 38rem;
padding: 2rem;
margin: auto;
line-height: 1.5rem;
font-size: 24px;
}
// pages/posts/[slug].tsx
import Head from "next/head";
import Link from "next/link";
import styles from "../../styles/Post.module.scss";
import { GetStaticProps, GetStaticPaths } from "next";
const Post = ({ post }) => {
// console.log(post);
return (
// ref: https://github.com/twbs/stylelint-config-twbs-bootstrap/blob/main/css/index.js
'order/properties-order': [
'position',
'top',
'right',
'bottom',
'left',
'z-index',
'box-sizing',
// ==========================================
// RECESS
// RULE: Must use correct property ordering
// ==========================================
// Copyright 2012 Twitter, Inc
// Licensed under the Apache License v2.0
// http://www.apache.org/licenses/LICENSE-2.0
// ==========================================
// (ref: https://github.com/twitter/recess/blob/8a4835299518a57c71fb11cb7dc87cd1577a9872/lib/lint/strict-property-order.js)
// redux store로부터 불러온 card data
const { cards } = this.props;
{cards.map((card, idx) => {
<Formik
key={card.id}
initialValues={{
id: card.id,
cardtype: card.cardtype,
question: card.question,
import { ADD_CARD, SHOW_CARD } from "../actions/cardActions.js";
const reducer = (state = initialState, action) => {
switch (action.type) {
case SHOW_CARD:
return Object.assign({}, state, { cards: action.cards });
// ...
}
import axios from "axios";
export const SHOW_CARD = "SHOW_CARD";
// 서버로부터 카드 데이터 가져오기
export function getDeckCards() {
return dispatch => {
axios
.get("http://localhost:4000/card/cardInfo")
.then(res => {
import Card from "../components/Card";
import { connect } from "react-redux";
// 컴포넌트에서 필요한 데이터를 store에서 추출하여 객체 반환
function mapStateToProps(state) {
return {
cards: state.card.cards,
decks: state.deck.decks,
category: state.deck.category,
};
//* Formik props
const initialValues = {
decks: [""], // --- 1️⃣
};
const onSubmit = (values, actions) => {
registerDeck(values.decks);
getDeck();
// 입력창 초기화
actions.resetForm({
// Header.js
import React from "react";
import { Link, withRouter } from "react-router-dom";
import "../styles/header.css";
import NavBar from "./NavBar";
function Header(props) {
console.log(props);