Skip to content

Instantly share code, notes, and snippets.

View skolhustick's full-sized avatar

eshwarenm skolhustick

View GitHub Profile
name: Node.js CI
on: [push]
jobs:
build:
runs-on: self-hosted
strategy:
@skolhustick
skolhustick / next.config.js
Created February 15, 2020 07:50
next-js-pwa-setup
const withPWA = require('next-pwa')
module.exports = withPWA({
pwa: {
dest: 'public'
}
})
@skolhustick
skolhustick / metatags.html
Created February 15, 2020 10:05
next-js-pwa-metatags
<meta charset='utf-8' />
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta name='viewport' content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no' />
<meta name='description' content='Description' />
<meta name='keywords' content='Keywords' />
<title>Next.js PWA Example</title>
<link rel="manifest" href="/manifest.json" />
<link href='/favicon-16x16.png' rel='icon' type='image/png' sizes='16x16' />
<link href='/favicon-32x32.png' rel='icon' type='image/png' sizes='32x32' />
@skolhustick
skolhustick / nav.js
Created February 15, 2020 10:12
next-js-pwa-nav-js-metatags
import React from 'react'
import Link from 'next/link'
import Head from 'next/head'
const links = [
{ href: 'https://zeit.co/now', label: 'ZEIT' },
{ href: 'https://github.com/zeit/next.js', label: 'GitHub' }
].map(link => ({
...link,
key: `nav-link-${link.href}-${link.label}`
@skolhustick
skolhustick / Button.js
Created February 22, 2020 14:14
NextJS Dark Theme
import styled from 'styled-components'
const Button = styled.button`
background: ${props => props.theme.bg.primary};
color: ${props => props.theme.fontColor};
`
Button.defaultProps = {
theme: {
bg: 'white',
@skolhustick
skolhustick / theme.js
Last active February 22, 2020 14:16
NextJS styled-components theme file
const light = {
bg: 'white',
fontColor: 'purple'
}
const dark = {
bg: 'black',
fontColor: 'white'
}
@skolhustick
skolhustick / Button.js
Created February 22, 2020 14:22
NextJS styled-components example component
import styled from 'styled-components'
const Button = styled.button`
background: ${props => props.theme.bg};
color: ${props => props.theme.fontColor};
`
Button.defaultProps = {
theme: {
bg: 'white',
@skolhustick
skolhustick / _app.js
Created February 22, 2020 14:28
NextJS styled-components _app.js
import React, { useState, useEffect } from 'react'
import useDarkMode from 'use-dark-mode'
import { ThemeProvider } from 'styled-components'
import { lightTheme, darkTheme } from '../theme'
const MyApp = ({ Component, pageProps }) => {
const [isMounted, setIsMounted] = useState(false)
const darkMode = useDarkMode(true)
const theme = darkMode.value ? darkTheme : lightTheme
@skolhustick
skolhustick / index.js
Created February 22, 2020 14:41
NextJS styled-components index.js
import React from 'react'
import Button from '../components/Button'
const Home = () => {
return <Button>Theme Test</Button>
}
export default Home
@skolhustick
skolhustick / App.js
Created May 25, 2020 07:55
ChakraUI - Login Form with ColorMode
import React from 'react'
import {
ThemeProvider,
theme,
ColorModeProvider,
CSSReset,
Box,
Flex,
IconButton,
useColorMode,