Skip to content

Commit

Permalink
Sticky footerの設定・ランダムIDの生成ページの作成等
Browse files Browse the repository at this point in the history
  • Loading branch information
nedew committed Oct 23, 2020
1 parent 31115a3 commit 2feaab8
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 8 deletions.
1 change: 1 addition & 0 deletions components/styles/footer.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
padding: 1.5rem 0;
margin-top: auto;
border-top: 1px solid #ededed;
margin-top: auto;
}

.footerContainer {
Expand Down
14 changes: 8 additions & 6 deletions components/styles/layout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
padding-left: $widePaddingLeft;
padding-bottom: $widePaddingBottom;

// Mobile
@media screen and (max-width: $breakPoint) {
padding-top: $narrowPaddingTop;
padding-right: $narrowPaddingRight;
Expand All @@ -29,8 +30,9 @@
@media screen and (max-width: $maxWidth) {
margin-top: 0px;
margin-bottom: 0px;
z-index: -1;
// z-index: -1;
border-radius: inherit;
box-shadow: inherit;
}
}

Expand All @@ -46,8 +48,8 @@

// }

// .area {
// display: flex;
// flex-direction: column;
// min-height: 100vh;
// }
.area {
display: flex;
flex-direction: column;
min-height: 100vh;
}
14 changes: 14 additions & 0 deletions lib/generateUniqueId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export function generateUniqueId(ids: string[]) {
let uniqueId:string
let isDone:boolean = false

while (!isDone) {
uniqueId = ('00000' + Math.floor(Math.random() * 100000)).slice(-5)
if (ids.indexOf(uniqueId) !== -1) {
continue
}
isDone = true
}

return uniqueId
}
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { siteName } from '../config/blog.config.json'

export default class MyDocument extends Document {
render() {
return (
<Html lang="ja">
<Head>
{/* <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Audiowide&family=Mitr&family=Varela+Round&family=Bungee&family=Righteous&family=Russo+One&family=Luckiest+Guy&family=Montserrat+Alternates:wght@800;900&family=Six+Caps&family=Alegreya+Sans+SC:wght@900&display=swap" rel="stylesheet" /> */}
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Orbitron:wght@900&display=swap" rel="stylesheet" />
</Head>
<body>
Expand Down
31 changes: 31 additions & 0 deletions pages/generate-id.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Head from 'next/head'
import { GetStaticProps } from 'next'
import Layout from '../components/Layout'
import utilStyles from '../components/styles/util.module.scss'
import articleIds from '../gen/articleIds.json'
import { siteName } from '../config/blog.config.json'
import { generateUniqueId } from '../lib/generateUniqueId'

export default ({ uniqueId }: { uniqueId: string }) => {
return (
<>
<Head>
<title>Generate article id | {siteName}</title>
<link rel="icon" href="/favicon.ico" />
<script type="text/javascript" src="/js/generateArticleId.js"></script>
</Head>
<Layout>
<h1 className={utilStyles.pageTitle}>GENERATE ID</h1>
<h2>Unique ID: {uniqueId}</h2>
</Layout>
</>
)
}

export const getStaticProps: GetStaticProps = async () => {
return {
props: {
uniqueId: generateUniqueId(Object.keys(articleIds)),
}
}
}
3 changes: 2 additions & 1 deletion pages/tags/[tag].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ArticleList from '../../components/ArticleList'
import Head from 'next/head'
import utilStyles from '../../components/styles/util.module.scss'
import { GetStaticProps, GetStaticPaths } from 'next'
import { getSortedArticles } from '../../lib/getArticle'
import tagMap from '../../gen/tagMap.json'
import { siteName } from '../../config/blog.config.json'

Expand Down Expand Up @@ -46,7 +47,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
return {
props: {
tag: tag,
articles: tagMap[tag],
articles: getSortedArticles(),
}
}
}

1 comment on commit 2feaab8

@vercel
Copy link

@vercel vercel bot commented on 2feaab8 Oct 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.