├── .dockerignore ├── public ├── favicon.ico └── index.html ├── src ├── assets │ ├── logo.png │ └── styles │ │ ├── global.scss │ │ └── prism.css ├── components │ ├── myself │ │ ├── Resume.jsx │ │ └── Summary.jsx │ ├── posts │ │ ├── SearchContainer.jsx │ │ ├── NoPostMessage.jsx │ │ ├── PostsContainer.jsx │ │ ├── PostFullText.jsx │ │ ├── BaseContainer.jsx │ │ ├── PostComments.jsx │ │ └── AddNewCommnet.jsx │ └── common │ │ ├── Layout.jsx │ │ ├── Footer.jsx │ │ ├── SearchBar.jsx │ │ ├── SideBar.jsx │ │ └── NavBar.jsx ├── apis │ ├── base.js │ ├── metas.js │ └── posts.js ├── utils │ ├── consts.js │ ├── alert.js │ └── google.js ├── contexts │ └── PostContext.js └── reducers │ └── PostReducer.js ├── screenshots └── Code_Highlight.png ├── README.CN.md ├── pages ├── error.js ├── resume.js ├── post │ └── [pid].js ├── search.js ├── _document.js ├── category │ └── [cid].js ├── _app.js └── index.js ├── .gitignore ├── Dockerfile ├── buzzy.config.demo.js ├── prettier.config.js ├── babel.config.js ├── LICENSE ├── server.js ├── next.config.js ├── README.md └── package.json /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buzzycloud/buzzyblog/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buzzycloud/buzzyblog/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /screenshots/Code_Highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buzzycloud/buzzyblog/HEAD/screenshots/Code_Highlight.png -------------------------------------------------------------------------------- /README.CN.md: -------------------------------------------------------------------------------- 1 | :point_right: [English Documetation](README.md) 2 | 3 | :point_down: 中文文档 4 | 5 | --- 6 | 7 | ## Buzzy CMS 8 | -------------------------------------------------------------------------------- /pages/error.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const ErrorPage = () => { 4 | return
404 Not Found
; 5 | }; 6 | 7 | export default ErrorPage; 8 | -------------------------------------------------------------------------------- /src/components/myself/Resume.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Resume = (props) => { 4 | return
Resume
; 5 | }; 6 | 7 | export default Resume; 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .vscode/ 3 | .idea/ 4 | 5 | # build 6 | build/ 7 | dist/ 8 | out/ 9 | 10 | # logs 11 | *.log 12 | 13 | # config 14 | buzzy.config.js -------------------------------------------------------------------------------- /pages/resume.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Resume from "src/components/myself/Resume"; 3 | 4 | const ResumePage = () => { 5 | return ; 6 | }; 7 | 8 | export default ResumePage; 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12.16.1-buster 2 | 3 | ENV IS_DOCKER=1 4 | 5 | WORKDIR ~/app/buzzyblog 6 | COPY . . 7 | 8 | RUN npm install && npm run next:build 9 | 10 | EXPOSE 8000 11 | CMD ["node", "server.js" ] 12 | -------------------------------------------------------------------------------- /src/components/myself/Summary.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | /** Blogger Info Summary on hover */ 4 | const Summary = () => { 5 | return
Summary
; 6 | }; 7 | 8 | export default Summary; 9 | -------------------------------------------------------------------------------- /src/apis/base.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | 3 | const isProd = process.env.NODE_ENV === "production"; 4 | 5 | const BASE_URL = isProd ? process.env.API_PROD : process.env.API_DEV; 6 | 7 | export { axios, BASE_URL }; 8 | -------------------------------------------------------------------------------- /src/utils/consts.js: -------------------------------------------------------------------------------- 1 | /** 2 | * React context action types 3 | */ 4 | export const ACTIONS = { 5 | INIT_POSTS: "INIT_POSTS", 6 | SEARCH_POSTS: "SEARCH_POSTS", 7 | }; 8 | 9 | export const ALERT_OPTS = { 10 | POSITION: "top", 11 | TIMER: 2000, 12 | }; 13 | -------------------------------------------------------------------------------- /buzzy.config.demo.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | HTML_TITLE: "Awesome JavaScript", 4 | API_PROD: "http://localhost:8080", // deploy next app and wp in the same vm instance 5 | API_DEV: "http://localhost:8080", 6 | GA_TRACKING_ID: "", 7 | SENTRY_DSN: "", 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | // prettier.config.js or .prettierrc.js 2 | module.exports = { 3 | printWidth: 120, 4 | trailingComma: "es5", 5 | tabWidth: 4, 6 | semi: true, 7 | singleQuote: false, 8 | bracketSpacing: true, 9 | jsxBracketSameLine: false, 10 | arrowParens: "always", 11 | endOfLine: "lf", 12 | }; 13 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /src/assets/styles/global.scss: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | width: 100%; 5 | } 6 | 7 | #__next { 8 | min-height: 100%; 9 | display: grid; 10 | grid-template-rows: auto 1fr auto; 11 | grid-template-columns: 100%; 12 | } 13 | 14 | .is-clickable { 15 | cursor: pointer; 16 | 17 | :hover { 18 | text-decoration: underline; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | module.exports = { 3 | presets: ["next/babel"], 4 | plugins: [ 5 | [ 6 | "module-resolver", 7 | { 8 | root: ["./"], 9 | alias: { 10 | src: "./src", 11 | pages: "./pages", 12 | "test": "./test", 13 | }, 14 | }, 15 | ], 16 | ["styled-components", { ssr: true }], 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /src/contexts/PostContext.js: -------------------------------------------------------------------------------- 1 | import React, { createContext, useReducer } from "react"; 2 | import PostReducer from "src/reducers/PostReducer"; 3 | 4 | const PostContext = createContext(); 5 | 6 | export default PostContext; 7 | 8 | const initialState = { all: [], pinned: [], search: [], tags: {} }; 9 | 10 | export const PostContextProvider = (props) => { 11 | const [postState, dispatch] = useReducer(PostReducer, initialState); 12 | return {props.children}; 13 | }; 14 | -------------------------------------------------------------------------------- /src/utils/alert.js: -------------------------------------------------------------------------------- 1 | import Swal from "sweetalert2/dist/sweetalert2.js"; 2 | import "sweetalert2/src/sweetalert2.scss"; 3 | import { ALERT_OPTS } from "./consts"; 4 | 5 | export const fire = async ({ type, msg, submsg = "Please try again!" }) => { 6 | await Swal.fire({ 7 | position: ALERT_OPTS.POSITION, 8 | type: type, 9 | titleText: msg, 10 | text: submsg, 11 | showConfirmButton: false, 12 | allowOutsideClick: false, 13 | allowEscapeKey: false, 14 | timer: ALERT_OPTS.TIMER, 15 | }); 16 | }; 17 | -------------------------------------------------------------------------------- /src/reducers/PostReducer.js: -------------------------------------------------------------------------------- 1 | import { ACTIONS } from "src/utils/consts"; 2 | 3 | const PostReducer = (state, action) => { 4 | const { type, val } = action; 5 | switch (type) { 6 | case ACTIONS.INIT_POSTS: 7 | return { ...val }; 8 | case ACTIONS.SEARCH_POSTS: 9 | return { 10 | ...state, 11 | search: [...val.search], 12 | tags: { ...val.tags }, 13 | }; 14 | default: 15 | return state; 16 | } 17 | }; 18 | 19 | export default PostReducer; 20 | -------------------------------------------------------------------------------- /src/components/posts/SearchContainer.jsx: -------------------------------------------------------------------------------- 1 | import React, { useContext } from "react"; 2 | import PostContext from "src/contexts/PostContext"; 3 | import BaseContainer from "./BaseContainer"; 4 | import NoPostMessage from "./NoPostMessage"; 5 | 6 | const SearchContainer = () => { 7 | const { 8 | postState: { search, tags }, 9 | } = useContext(PostContext); 10 | 11 | if (search.length === 0) { 12 | return ; 13 | } 14 | 15 | return ; 16 | }; 17 | 18 | export default SearchContainer; 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Yumin Gui 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const dev = process.env.NODE_ENV !== "production"; 3 | const next = require("next")({ dev }); 4 | const handle = next.getRequestHandler(); 5 | 6 | next.prepare().then(() => { 7 | const server = express(); 8 | server.use(require("helmet")({ 9 | hidePoweredBy: { setTo: "Buzzy Blog" } 10 | })); 11 | server.get("*", (req, res) => { 12 | return handle(req, res); 13 | }); 14 | 15 | const PORT = process.env.PORT || 8081; 16 | 17 | server.listen(PORT, (err) => { 18 | if (err) throw err; 19 | console.log(`Server is running on http://localhost:${PORT}`); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/components/common/Layout.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import "bulma/css/bulma.min.css"; 3 | import "@fortawesome/fontawesome-free/css/all.min.css"; 4 | 5 | import NavBar from "./NavBar"; 6 | import Footer from "./Footer"; 7 | import styled, { css } from "styled-components"; 8 | 9 | const Container = styled.div.attrs({ 10 | className: "container", 11 | })` 12 | margin: 0 5%; 13 | `; 14 | 15 | const Layout = ({ children }) => { 16 | return ( 17 | 18 | 19 | {children} 20 |