Giter VIP home page Giter VIP logo

gatsby-theme-teranova's Introduction

Gatsby Theme Teranova

Warning: Not actively developed anymore

Teranova is a free open-source gatsby theme which you can use to make a simple, modern and customizable responsive landing page.

You can view the live demo to see how it looks.

Features

  • 4 different sections (header, about us, services, contact) by default
  • Easy to customize styles with theme UI
  • Google map embed and Google analytics
  • Smooth scrolling links
  • MDX support
  • Good SEO support with React Helmet and a default seo component
  • PWA
  • Sitemap (in case you want to add extra pages)
  • Responsive design
  • Emotion for styling
  • Prefetched google fonts
  • Supports any google font

Installation

To use this theme in your Gatsby sites, follow these instructions:

  1. Install the theme

    npm i gatsby-theme-teranova

    or

    yarn add gatsby-theme-teranova
  2. Add the theme to your gatsby-config.js with any of the following options. Every option has a default value which is given below so there are no required options.

    module.exports = {
      plugins: [
        {
          resolve: "gatsby-theme-teranova",
          options: {
            title: 'Teranova',
            description: 'A single page gatsby theme created by Nirjan Khadka',
            image: '/images/banner.png', // for image meta tag (lmage location within the static folder)
            twitterUsername: '@nk13_codes', // the site link (eg: https://twitter.com/) will be added for all social links so just put the profile name here
            facebookUsername: 'nk13_codes',
            instagramUsername: 'nk13_codes',
            phone: '555 219 619',
            email: '[email protected]',
            address: 'Stewart Street, Marks Avenue, California',
            mapUrl: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3306.033277112893!2d-118.26944278515673!3d34.04301748060843!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x80c2c7b85dea2a93%3A0x1ff47c3ceb7bb2d5!2sSTAPLES+Center!5e0!3m2!1sen!2snp!4v1564632144369!5m2!1sen!2snp', // google maps iframe url
            logo: '/images/logo.svg', // link from the static folder
            trackingId: 'UA-135638651-2', // GA key
            // options for gatsby plugin manifest (go to there docs to learn more)
            shortName: 'teranova',
            pathPrefix: '/',
            backgroundColor: '#F9F9F9',
            themeColor: '#FFD700',
            favicon: 'static/images/favicon.png', // path from the root
            // gatsby sitemap plugin needs this
            siteUrl: 'https://teranova.netlify.com',
          
            // font options
            headingFont:  'Vollkorn', // accepts any google font name 
            bodyFont: 'Roboto',
    
            // content direcoty name
            contentFolder: 'teranova-theme-data',
                    
            // navbar links
            navLinks: [
                {
                    label: 'About',
                    link: '#about'
                },
                {
                    label: 'Services',
                    link: '#services'
                },
                {
                    label: 'Contact',
                    link: '#contact'
                }
            ]
          }
        }
      ]
    };
  3. There are mdx files and images for intro, services and about blocks in the content directory (teranova-theme-data by default). You can edit them to change the content of the site.

    1. intro.mdx with content that looks like this:
    ---
    type: intro
    img: ./banner.jpg
    ---
    
    ## Making good times Better
    
    We are a company dedicated to making your
    satisfaction into our goals. You don’t need to worry about a single thing.And
    now we are offering special discounts right now.
    1. about.mdx with content that looks like this:
    ---
    type: about
    img: ./about.jpg
    title: About us
    ---
    
    We Believe in a stronger community and a chance for redemption for every one and provide the opportunities that can lead to a better life for everyone. So, What are you waiting for? Join us today and be your best self. No more waiting, Join us before march to win exclusive prizes and a chance to win a million dollars.
    
    We Believe in a stronger community and a chance for redemption for every one and provide the opportunities that can lead to a better life for everyone. So, What are you waiting for? Join us today and be your best self. No more waiting, Join us before march to win exclusive prizes and a chance to win a million dollars.
    
    We Believe in a stronger community and a chance for redemption for every one and provide the opportunities that can lead to a better life for everyone. So, What are you waiting for? Join us today and be your best self. No more waiting, Join us before march to win exclusive prizes and a chance to win a million dollars.
    1. A service mdx file with looks like this:
    ---
    title: Branding
    type: service
    ---
    
    We provide the best branding solutions and optimized designs to go along with a rangle of supporting features for companies of all sizes.
  4. Add static/images/favicon.png to your project. The gatsby-plugin-manifest needs this image.

  5. Start your site

    gatsby develop
  6. You can override colors by creating a src/gatsby-theme-teranova/theme.js file and exporting an object with the following properties:

    export const theme = {
      fonts: {
        // only use the fonts that have been set in the theme options
        families: ["Roboto", "Vollkorn"],
        body: '"Roboto",sans-serif',
        heading: '"Vollkorn",serif'
      },
      fontSizes: [0.75, 1, 1.33, 1.77, 2.369, 3.157],
      fontWeights: {
        body: 400,
        heading: "700",
        bold: 700
      },
      spacing: [0.618, 1, 1.618, 2.618, 4.236, 6.854, 11.089],
      lineHeights: {
        body: 1.7,
        heading: 1.2
      },
      letterSpacings: {
        body: "normal",
        caps: "0.2rem"
      },
      colors: {
        primary: "#FFD700",
        dark: "#333",
        grey: "#B2AB99",
        secondaryLight: "#00FFD8",
        secondary: "#03866e",
        darkLight: "#5A5751",
        greyLight: "#F9F9F9",
        white: "#FEFEFE",
        secondaryDark: "#065648",
        primaryGradient:
          "linear-gradient(to right, rgba(242, 153, 74,0.9), rgba(242, 201, 76,0.4))"
      }
    };
  7. You can use gatsby theme shadowing to change any of the default components. You might want to change the layout component which orders the sections and provides some global css rules. To shadow that component create a src/gatsby-theme-teranova/components/layout.js. The default layout.js file looks like this

import React from 'react';
import Header from 'gatsby-theme-teranova/src/components/header';
import SEO from 'gatsby-theme-teranova/src/components/seo';
import 'normalize.css';
import { theme } from 'gatsby-theme-teranova/src/theme';
import { ThemeProvider } from 'theme-ui';
import { Global, css } from '@emotion/core';
import Footer from 'gatsby-theme-teranova/src/components/footer';
import Intro from 'gatsby-theme-teranova/src/components/intro';
import About from 'gatsby-theme-teranova/src/components/about';
import Services from 'gatsby-theme-teranova/src/components/services';
import Contact from 'gatsby-theme-teranova/src/components/contact';

function Layout() {
  return (
    <ThemeProvider theme={theme}>
      <Global
        styles={css`
          * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
          }
          body {
            line-height: ${theme.lineHeights.body};

            font-family: ${theme.fonts.body};
            color: ${theme.colors.dark};
          }
          h1,
          h2,
          h3,
          h4,
          h5,
          h6 {
            line-height: ${theme.lineHeights.heading};
            font-weight: ${theme.fontWeights.heading};
            font-family: ${theme.fonts.heading};
          }
          h1 {
            font-size: ${theme.fontSizes[5]}rem;
          }
          h2 {
            font-size: ${theme.fontSizes[4]}rem;
          }
          h3 {
            font-size: ${theme.fontSizes[3]}rem;
          }
          h4 {
            font-size: ${theme.fontSizes[2]}rem;
          }
          h5 {
            font-size: ${theme.fontSizes[1]}rem;
          }
          a {
            text-decoration: none;
            color: ${theme.colors.secondary};
            transition: color 200ms ease-out;
            &:hover,
            &:focus {
              color: ${theme.colors.primary};
            }
          }
        `}
      />
      <SEO />
      <Header />
      <main>
        <Intro />

        <About />

        <Services />

        <Contact />
      </main>
      <Footer />
    </ThemeProvider>
  );
}

export default Layout;

If you get stuck then take a look at the examples in this repo or create an issue with sufficient info on the problem. Collaborators are welcomed.

gatsby-theme-teranova's People

Contributors

nirjan-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gatsby-theme-teranova's Issues

Building the demo fails

I tried to setup the demo with nodeenv (virtual venv is called tk here) and run it. The first thing I discovered was that typescript was missing as dependency. I added it.

(tk) PS C:\Users\Florian\gitlab\tanjakromer> npm list --depth 0   
[email protected] C:\Users\Florian\gitlab\tanjakromer
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

However after following the instructions for setting up the files, etc. running gatsy develop failed with:

(tk) PS C:\Users\Florian\gitlab\tanjakromer> gatsby develop

 ERROR 

The above error occurred in the <StoreStateProvider> component:
    in StoreStateProvider
    in App

React will try to recreate this component tree from scratch using the error boundary you provided, App.


 ERROR 

Warning: App: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.


 ERROR 

UNHANDLED REJECTION Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.



  Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one   of the following reasons:
  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
  See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

  - react.development.js:1590 resolveDispatcher
    [tanjakromer]/[gatsby]/[react]/cjs/react.development.js:1590:13

  - react.development.js:1618 useState
    [tanjakromer]/[gatsby]/[react]/cjs/react.development.js:1618:20

  - context.js:17 StoreStateProvider
    [tanjakromer]/[gatsby]/[gatsby-cli]/lib/reporter/loggers/ink/context.js:17:41

  - react-reconciler.development.js:6036 renderWithHooks
    [tanjakromer]/[react-reconciler]/cjs/react-reconciler.development.js:6036:18

  - react-reconciler.development.js:8570 mountIndeterminateComponent
    [tanjakromer]/[react-reconciler]/cjs/react-reconciler.development.js:8570:13

  - react-reconciler.development.js:9938 beginWork$1
    [tanjakromer]/[react-reconciler]/cjs/react-reconciler.development.js:9938:16

  - react-reconciler.development.js:11563 Object.invokeGuardedCallbackImpl
    [tanjakromer]/[react-reconciler]/cjs/react-reconciler.development.js:11563:10

  - react-reconciler.development.js:11740 invokeGuardedCallback
    [tanjakromer]/[react-reconciler]/cjs/react-reconciler.development.js:11740:31

  - react-reconciler.development.js:15778 beginWork$$1
    [tanjakromer]/[react-reconciler]/cjs/react-reconciler.development.js:15778:7

  - react-reconciler.development.js:14696 performUnitOfWork
    [tanjakromer]/[react-reconciler]/cjs/react-reconciler.development.js:14696:12

Shadowing of index.js has no effect

During usage of the theme (e.g. in the demo) when overriding index.js via demo/src/gatsby-theme-teranova/data/index.js the customization is just ignored (gatsby develop).

Shadowing checklist

It turned out that the theme does not support shadowing. In consequence this means this repo has to be used as a starter, not like a theme. This lists summarizes what works w.r.t. shadowing and what does not yet:

  • Shadowing of favicon (via demo/static/images/favicon.png) #13
  • Shadowing of themes.js (via demo/src/gatsby-theme-teranova/theme.js), but wrong instructions #8
  • Shadowing of index.mdx (via src/gatsby-theme-teranova/pages/index.mdx), but wrong instructions #11
  • Shadowing of about, services, etc. sections
  • Shadowing of index.js #7
  • Shadowing of navbar.js (for adding custom sections) #14

Shadowing of theme.js has no effect

During usage of the theme (e.g. in the demo) when trying to override theme.js via demo/src/gatsby-theme-teranova/src/theme.js the build fails (gatsby develop):

success Building development bundle - 4.554s

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

ENOENT: no such file or directory, open 'C:\Users\Florian\gitlab\gatsby-theme-teranova\demo\src\gatsby-theme-teranova\theme.js'

File: src\gatsby-theme-teranova\theme.js

failed Re-building development bundle - 0.360s

How to shadow builtin demo webpage content?

I thought the textual content of a theme webpage is defined in *.mdx files (gatsby-theme-teranova/data/content/about.mdx, gatsby-theme-teranova/data/content/contact.mdx, etc.) and is rendered with corresponding *.js files of the theme (gatsby-theme-teranova/src/components/about.js, gatsby-theme-teranova/src/components/contact.js, etc.). There is just demo/src/pages/index.mdx in the demo. Means the theme buildin content is not modified in the demo. I expected that placing custom text content in demo/data/gatsby-theme-teranova/content/about.mdx, etc. would shadow the corresponding webpage content. At least this seems to be the way how shadowing usually works according to the docs. But when running gatsby develop the custom text is not shown. The shadowed file seems to be just ignored. How is done shadowing of the webpage text correctly?

Improve theme adaptability

In case a user wants to modify the theme she could do so by overriding files about.js, contact.js, contactinfo.js, etc. in her site or custom demo via pasting them into custom-demo/src/gatsby-theme-teranova/components. However many component files reference other component files via import xxx from './<path>' style imports. Could we change them to import xxx from 'gatsby-theme-teranova/src/components/<path>. This would ease adaptability and people would have an easier time contributing to your theme.

Wrong overriding instructions and file location in demo (index.mdx)

When placing index.mdx for overriding into src/pages/index.mdx and building with gatsby develop one gets this build error:

When success Re-building development bundle - 0.176s

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

ENOENT: no such file or directory, open 'C:\Users\Florian\gitlab\tanjakromer\src\gatsby-theme-teranova\pages\index.mdx'

File: src\gatsby-theme-teranova\pages\index.mdx

Placing the file into src/gatsby-theme-teranova/pages/index.mdx instead fixes the error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.