Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…s-handbook into feature/6

# Conflicts:
#	src/theme/Root.js
  • Loading branch information
정대윤 committed Aug 20, 2021
2 parents c928617 + 9998e99 commit 23e0b74
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 69 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

#Ide
.idea
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
}
Expand Down
16 changes: 8 additions & 8 deletions src/components/HomepageFeatures.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import React from 'react';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import mq from 'theme/mq';

const FeatureList = [
{
title: "DAU, GA... 먹는건가요?",
Svg: require("../../static/img/undraw_docusaurus_mountain.svg").default,
title: 'DAU, GA... 먹는건가요?',
Svg: require('../../static/img/undraw_docusaurus_mountain.svg').default,
description: (
<>
사용자 데이터 분석(Daily Active User, 전환율 측정 등)은 모던 웹
Expand All @@ -17,17 +17,17 @@ const FeatureList = [
),
},
{
title: "개발자에게 필요한 웹 분석 지식",
Svg: require("../../static/img/undraw_docusaurus_tree.svg").default,
title: '개발자에게 필요한 웹 분석 지식',
Svg: require('../../static/img/undraw_docusaurus_tree.svg').default,
description: (
<>
여러분의 프로젝트에 웹 분석 툴을 연동하기 위해선 어떤 코드가 필요할까요?
</>
),
},
{
title: "GA와 Amplitude를 한번에",
Svg: require("../../static/img/undraw_docusaurus_react.svg").default,
title: 'GA와 Amplitude를 한번에',
Svg: require('../../static/img/undraw_docusaurus_react.svg').default,
description: (
<>
react-analytics-provider 오픈소스를 통해 Google Analytics, Amplitude와
Expand Down Expand Up @@ -85,7 +85,7 @@ const FeatureDescription = styled.p``;
const FeatureContainer = styled.div`
${mq()({
flex: ['0 0 100%', '0 0 calc(4/12 * 100%)'],
maxWidth: ['100%', 'calc(4/12 * 100%)']
maxWidth: ['100%', 'calc(4/12 * 100%)'],
})}
`;

Expand Down
26 changes: 8 additions & 18 deletions src/components/WikiTable/WikiTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,24 @@ import words from '../../../wiki.json';
import usePagination from '../../hooks/usePagination';

export default function WikiTable() {
const {
onPrevious,
onNext,
currentPage,
result,
isLastPage,
isFirstPage
} = usePagination({
source: words,
offset: 2
});
const { onPrevious, onNext, currentPage, result, isLastPage, isFirstPage } =
usePagination({
source: words,
offset: 2,
});

return (
<>
<span>{currentPage}</span>
<button
onClick={onPrevious}
disabled={isFirstPage}>
<button onClick={onPrevious} disabled={isFirstPage}>
Previous
</button>
<button
onClick={onNext}
disabled={isLastPage}>
<button onClick={onNext} disabled={isLastPage}>
Next
</button>
<table>
<tbody>
{result.map((word) => (
{result.map(word => (
<WikiTableRow key={word.name} {...word} />
))}
</tbody>
Expand Down
16 changes: 6 additions & 10 deletions src/hooks/usePagination.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { useEffect, useState } from 'react';

const usePagination = ({
source = [],
initialPage = 1,
offset = 10
}) => {
const usePagination = ({ source = [], initialPage = 1, offset = 10 }) => {
const minPage = 1;
const maxPage = Math.ceil(source.length / offset);

Expand All @@ -14,17 +10,17 @@ const usePagination = ({
useEffect(() => {
const startIdx = (currentPage - 1) * offset;
const endIdx = startIdx + offset;

setResult(source.slice(startIdx, endIdx));
}, [currentPage]);

const onPrevious = () => {
if(currentPage <= minPage) return;
if (currentPage <= minPage) return;
setCurrentPage(currentPage - 1);
};

const onNext = () => {
if(currentPage >= maxPage) return;
if (currentPage >= maxPage) return;
setCurrentPage(currentPage + 1);
};

Expand All @@ -34,8 +30,8 @@ const usePagination = ({
isLastPage: currentPage === maxPage,
isFirstPage: currentPage === minPage,
onPrevious,
onNext
onNext,
};
};

export default usePagination;
export default usePagination;
30 changes: 15 additions & 15 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from "react";
import clsx from "clsx";
import Layout from "@theme/Layout";
import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import styles from "./index.module.css";
import HomepageFeatures from "components/HomepageFeatures";
import Footer from "theme/Footer";
import React from 'react';
import clsx from 'clsx';
import Layout from '@theme/Layout';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import styles from './index.module.css';
import HomepageFeatures from 'components/HomepageFeatures';
import Footer from 'theme/Footer';

function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();
return (
<header className={clsx("hero hero--primary", styles.heroBanner)}>
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
Expand All @@ -20,9 +20,9 @@ function HomepageHeader() {
className="button button--secondary button--lg"
to="/docs/handbook/intro"
onClick={() => {
gtag("event", "핸드북 읽기 클릭", {
event_category: "메인페이지",
event_label: "라벨",
gtag('event', '핸드북 읽기 클릭', {
event_category: '메인페이지',
event_label: '라벨',
});
}}
>
Expand All @@ -35,9 +35,9 @@ function HomepageHeader() {
className="button button--secondary button--lg"
to="/docs/react-analytics-provider/intro"
onClick={() => {
gtag("event", "react-analytics-provider 클릭", {
event_category: "메인페이지",
event_label: "라벨",
gtag('event', 'react-analytics-provider 클릭', {
event_category: '메인페이지',
event_label: '라벨',
});
}}
>
Expand Down
8 changes: 4 additions & 4 deletions src/pages/wiki/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import Layout from "@theme/Layout";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import React from 'react';
import Layout from '@theme/Layout';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';

import WikiTable from '../../components/WikiTable'
import WikiTable from '../../components/WikiTable';

export default function Wiki() {
const { siteConfig } = useDocusaurusContext();
Expand Down
16 changes: 9 additions & 7 deletions src/theme/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import React from 'react';
import clsx from 'clsx';

import Link from '@docusaurus/Link';
import {FooterLinkItem, useThemeConfig} from '@docusaurus/theme-common';
import { FooterLinkItem, useThemeConfig } from '@docusaurus/theme-common';
import useBaseUrl from '@docusaurus/useBaseUrl';
import isInternalUrl from '@docusaurus/isInternalUrl';
import styles from './styles.module.css';
import ThemedImage, {Props as ThemedImageProps} from '@theme/ThemedImage';
import ThemedImage, { Props as ThemedImageProps } from '@theme/ThemedImage';
import IconExternalLink from '@theme/IconExternalLink';

function FooterLink({
Expand All @@ -24,7 +24,7 @@ function FooterLink({
...props
}: FooterLinkItem) {
const toUrl = useBaseUrl(to);
const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
const normalizedHref = useBaseUrl(href, { forcePrependBaseUrl: true });

return (
<Link
Expand All @@ -36,7 +36,8 @@ function FooterLink({
: {
to: toUrl,
})}
{...props}>
{...props}
>
{href && !isInternalUrl(href) ? (
<span>
{label}
Expand All @@ -57,9 +58,9 @@ const FooterLogo = ({
);

function Footer(): JSX.Element | null {
const {footer} = useThemeConfig();
const { footer } = useThemeConfig();

const {copyright, links = [], logo = {}} = footer || {};
const { copyright, links = [], logo = {} } = footer || {};
const sources = {
light: useBaseUrl(logo.src),
dark: useBaseUrl(logo.srcDark || logo.src),
Expand All @@ -73,7 +74,8 @@ function Footer(): JSX.Element | null {
<footer
className={clsx('footer', {
'footer--dark': footer.style === 'dark',
})}>
})}
>
<div className="container">
{links && links.length > 0 && (
<div className="row footer__links">
Expand Down
10 changes: 5 additions & 5 deletions src/theme/mq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ type DeviceSize = 'm';

type DeviceWidth = {
[key in DeviceSize]: number;
}
};

const deviceWidth: DeviceWidth = {
m: 1000
}
m: 1000,
};

const mq = (breakpoints = deviceWidth): DynamicStyleFunction => {
const mediaQueries: string[] = Object.values(breakpoints)
.sort((curr: number, next: number) => curr - next)
.map((breakpoint: number) => `@media(min-width: ${breakpoint}px)`);

return facepaint(mediaQueries, { overlap: true});
}
return facepaint(mediaQueries, { overlap: true });
};

export default mq;
2 changes: 1 addition & 1 deletion wiki.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"description": "고객이 제품에 참여하는(engage) 방식을 이해하는 데 사용하는 프로세스입니다. "
},
{
"name": "Session (세션)",
"name": "세션 (Session)",
"description": "GA에서 Session은 사용자의 특정 활동 시간이며, 특정 시간안에서 사용자의 여러 상호작용의 집합입니다. (기본 설정 30분)"
},
{
Expand Down

0 comments on commit 23e0b74

Please sign in to comment.