Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions examples/gql-blog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
68 changes: 68 additions & 0 deletions examples/gql-blog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `yarn build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
46 changes: 46 additions & 0 deletions examples/gql-blog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "blog-query",
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.11",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"graphql": "^15.3.0",
"graphql-request": "^3.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-markdown": "^4.3.1",
"react-query": "^2.23.1",
"react-query-devtools": "^2.5.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"react-syntax-highlighter": "^15.1.0",
"sriracha-ui": "^1.8.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/gql-blog/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/gql-blog/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/gql-blog/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/gql-blog/public/favicon.ico
Binary file not shown.
38 changes: 38 additions & 0 deletions examples/gql-blog/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>React Query GQL Blog</title>
<meta charSet="utf-8" />
<meta name="viewport"
content="initial-scale=1.0, width=device-width" />
<link rel="apple-touch-icon" sizes="180x180"
href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32"
href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16"
href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg"
color="#5bbad5" />
<meta name="msapplication-TileColor" content="#ffc40d" />
<meta name="theme-color" content="#fafafa" />
</head>

<body>
<noscript>You need to enable JavaScript to run this
app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>

</html>
3 changes: 3 additions & 0 deletions examples/gql-blog/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
16 changes: 16 additions & 0 deletions examples/gql-blog/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "",
"short_name": "",
"icons": [{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
32 changes: 32 additions & 0 deletions examples/gql-blog/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";

import { Switch, Route } from "react-router";
import Layout from "./components/Layout";
import Home from "./pages/Home";
import Blog from "./pages/Blog";

import { AppContainer, useDarkMode } from "sriracha-ui";

import { library } from "@fortawesome/fontawesome-svg-core";
import { faMoon, faSun, faSpinner } from "@fortawesome/free-solid-svg-icons";
import About from "./pages/About";

library.add(faMoon, faSun, faSpinner);

function App() {
const { themeString, toggleTheme } = useDarkMode();

return (
<AppContainer themeString={themeString} toggleTheme={toggleTheme}>
<Layout>
<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/about" component={About} />
<Route exact path="/:slug" component={Blog} />
</Switch>
</Layout>
</AppContainer>
);
}

export default App;
15 changes: 15 additions & 0 deletions examples/gql-blog/src/components/Layout/NavLinks/NavLink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import { Flex, Text } from "sriracha-ui";
import { Link } from "react-router-dom";

export default function NavLink({ link }) {
return (
<Flex aic wrap="true" pointer>
<Link to={link === "Home" ? "/" : `/${link.toLowerCase()}`}>
<Text lf pointer color="gray9" hvrColor="gray5">
{link}
</Text>
</Link>
</Flex>
);
}
17 changes: 17 additions & 0 deletions examples/gql-blog/src/components/Layout/NavLinks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import { Box } from "sriracha-ui";
import NavLink from "./NavLink";

export default function NavLinks() {
const links = ["Home", "About"];
return (
<>
{links.map((link) => (
<React.Fragment key={link}>
<NavLink link={link} />
<Box w="2rem" />
</React.Fragment>
))}
</>
);
}
76 changes: 76 additions & 0 deletions examples/gql-blog/src/components/Layout/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from "react";
import {
Wrapper,
NavBar,
Box,
Flex,
Cabinet,
useCabinet,
useTheme,
} from "sriracha-ui";
import NavLinks from "./NavLinks";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

const navHeight = "5rem";

export default function Layout({ children }) {
const { isCabinet, toggleCabinet } = useCabinet();
const { toggleTheme, themeString, lightTheme } = useTheme();
const { colors } = lightTheme;
return (
<Wrapper>
<header>
<NavBar w="100%" bg="gray0" drape shadow={3} radius="0 0 0.4rem 0.4rem">
<Flex w="100%" jcb aic h={navHeight}>
<Box
className="nav-cabinet-menu"
m="0 0 0 2rem"
pointer
onClick={toggleCabinet}
>
<Flex drape w="2.2rem">
<Box h="0.2rem" w="2rem" bg="gray9" />
<Box h="0.5rem" />
<Box h="0.2rem" w="2rem" bg="gray9" />
<Box h="0.5rem" />
<Box h="0.2rem" w="2rem" bg="gray9" />
</Flex>
</Box>
<Box className="nav-link-list">
<Flex m="0 0 0 2rem">
<NavLinks />
</Flex>
</Box>
<Flex
as="button"
onClick={toggleTheme}
jcv
aic
p={1}
mr={3}
bg="none"
radius="0.5rem"
hvrBg="gray2"
>
{themeString === "dark" ? (
<FontAwesomeIcon icon="sun" color={colors.amber3} size="lg" />
) : (
<FontAwesomeIcon icon="moon" color={colors.purple7} size="lg" />
)}
</Flex>
</Flex>
</NavBar>
</header>
<Cabinet active={isCabinet} toggle={toggleCabinet} shade>
<Flex drape h="15rem" jcv>
<NavLinks toggleCabinet={toggleCabinet} />
</Flex>
</Cabinet>
<Flex drape stretch>
<Box h={navHeight} />
<Box />
{children}
</Flex>
</Wrapper>
);
}
14 changes: 14 additions & 0 deletions examples/gql-blog/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { BrowserRouter as Router } from "react-router-dom";
import "./styles.css";

ReactDOM.render(
<React.StrictMode>
<Router>
<App />
</Router>
</React.StrictMode>,
document.getElementById("root")
);
16 changes: 16 additions & 0 deletions examples/gql-blog/src/pages/About.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import { Card, Text } from "sriracha-ui";

export default function About() {
return (
<Card maxW={9} w="96%" shade>
<Text color="red6" size="5xl" as="h1" tac font="Raleway">
About page
</Text>
<Text as="p">
This is a simple blog created using React Query to manage all of our
server state from Best Markdown Editor.
</Text>
</Card>
);
}
Loading