Giter VIP home page Giter VIP logo

gatsby-theme-newrelic's Introduction

Community Project header

Gatsby New Relic Themes

This repo contains Gatsby themes used by New Relic Gatsby sites, including:

Installation

In your terminal:

git clone [email protected]:newrelic/gatsby-theme-newrelic.git
cd gatsby-theme-newrelic
yarn

Getting started

You can use the Demo Site included to test out changes to the theme. It's a much smaller package to build and serve than our other sites, so it's ideal for testing out changes to plugin behaviour, styling and our component library.

To run the Demo Site, simply use either of the following commands:

yarn start

...or...

yarn workspace demo develop

It should only take ~30 seconds to build and you should see...

success Building development bundle

...in the terminal, then you can visit http://localhost:8001 in your browser :)

Locally developing with another gatsby site

In the case that you would like to develop locally and test out your changes with another gatsby site, for example docs-website, you can symlink your local version of @newrelic/gatsby-theme-newrelic. In your local version of this repository, you can run:

cd gatsby-theme-newrelic
cd packages/gatsby-theme-newrelic
yarn
yarn link

Then, within the the repository you would like to see the changes, you can link to this version. For example, if you would like to see the changes in your local version of newrelic/docs-website.

cd docs-website
yarn link "@newrelic/gatsby-theme-newrelic"
yarn
yarn start

If you would like to stop using your local version and instead use the published version, you can remove the symlink from the package.

cd gatsby-theme-newrelic
cd packages/gatsby-theme-newrelic
yarn unlink

Lastly, you can unlink the package from the repository in which you are testing your changes.

cd docs-website
yarn unlink "@newrelic/gatsby-theme-newrelic"

Editing Content

We use MDX files for content which lets you seamlessly write JSX in your Markdown documents. This means you can write content in regular Markdown format as well as including React componenets in the same file. Gatsby will then do all the heavy-lifting to convert these to HTML to serve in the browser.

Example

For this example we will show how to add some content to a page and see the render results in the browser. We will use the build-hello-world-app document for testing, so with the develop server still running, navigate to and open the following in your favourite code editor:

  • demo/src/content/build-apps/build-hello-world-app.mdx

You should see something like the following (possibly less wine coloured):

drawing

  1. Frontmatter - This is key/value metadata you can provide for Gatsby which we won't go into now, but you can read more about here
  2. Markdown - This is regular Markdown language, and we'll include a guide on writing Markdown as well as a great resource for practicing online
  3. JSX/Components - These are the React components to super-charge your content, you can see the full list of components included in the theme here

Add some Markdown and JSX

Firstly we'll add some standard Markdown to the page, including a Header, bulleted list and link. Feel free to edit the examples:

## My First Edit

Look at me ma i'm creating content for

- New Relic
- Gatsby Theme
- [My inspiration](https://newrelic.com/)

Next we'll add a Button component that links to a site when you click it:

<Button variant="primary" to="https://newrelic.com/">
  Call Friends
</Button>

Your code should now look something like this...

drawing

...and as long as your develop server is still running the page should automatically reload with the new content...

drawing

Because we've added a Header, My First Edit should now be included in the On this page section on the right. Fresh! :D

Further Editing

With your new found confidence, check out the full documentation for the theme where you'll find more examples for:

Testing

We're currently developing this package, and will provide test information as we build out the library.

Upon pushing to the develop branch, a preview on a newrelic.com subdomain will be available here!

Support

New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Support Forum.

Contributing

We encourage your contributions to improve gatsby-theme-newrelic! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at [email protected].

License

gatsby-theme-newrelic is licensed under the Apache 2.0 License.

The gatsby-theme-newrelic also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.

gatsby-theme-newrelic's People

Contributors

aswanson-nr avatar aubreyhewes avatar austin-schaefer avatar brnhensley avatar caylahamann avatar clarkmcadoo avatar coreyarnold avatar dependabot[bot] avatar jbeveland27 avatar jerelmiller avatar jmiranr avatar josephgregoryii avatar kylegashler avatar lizbaker avatar mickeyryan42 avatar moonlightkomorebi avatar nr-opensource-bot avatar roadlittledawn avatar rudouglas avatar snyk-bot avatar sunnyzanchi avatar tabathadelane avatar tbutkiewicz avatar vladar avatar x8a avatar zstix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-theme-newrelic's Issues

Create a common right rail component that can be used across sites

Description

The docs site will have a "right rail" component that will show a few page-specific items.

The component will look similar to the right rail that appears on the developer site, so we want to abstract it to the theme. This component will continue to utilize its modular architecture to allow for customization of what goes in the right rail. This will also allow site-specific modules that can be used in the right rail.

We also plan to abstract a couple of the common modules that we know are used on all the sites. This includes the contributing module and the last modified module.

NOTE: This is followup of newrelic/docs-website#191 that is specific to the theme work. The docs-site work will be done as a part of newrelic/docs-website#191..

Acceptance Criteria

  • Generalized right-rail component added to the Gatsby theme
  • GitHub buttons link to the correct locations
  • Ability to set contributing guide (default to CONTRIBUTING.md)

Screenshot(s)

Right Rail on Developer Site:
Screen Shot 2020-10-29 at 4 02 30 PM

Wireframes for Docs Site:
Screen Shot 2020-10-29 at 4 03 24 PM

Transform gatsby components to render react-intl context

Summary

We need to set up gatsby-plugin-intl on our gatsby theme or provide a way to render context for the global header and footer, as well as a few other components used by our docs site.

AC

  • Gatsby theme allows for language context switching on our sites
  • Global header internationalized
  • Global footer internationalized
  • Code block internationalized
  • Feedback internationalized
  • Cookie Consent Dialog internationalized

Opening the search overlay does not autofocus the input

Description

Opening the search overlay by clicking the search icon in the header does not autofocus the input. It would be great to focus the input so that the user can just begin typing their search query without first needing to click on the input.

Steps to Reproduce

  1. Click the search icon in the header
  2. Notice the input is not focused

Expected Behaviour

The input is auto focused after opening the search overlay

Add the global header

All New Relic Gatsby sites have the same global header. Let's add the global header to this project.

According to the component audit these are the design specs we should be following:

  • Use the icons + size of the icons from the open source site
  • On small screens, render the New Relic logo without the text, but keep the circles
  • On mobile, always show the dark mode icon, but place it next to the hamburger menu

[NR Browser] Instrument CodeBlock component

Summary

We need to instrument our CodeBlock component with NR Browser. We need to track the following events:

  • copyCodeBlock_click: occurs when a user clicks on the "copy" button

Properties that we want to record with this action:

  • modified: whether the code was copied as is or was modified

AC

  • instrumented with NR browser agent
  • update spreadsheet with action name, additional properties, location implemented, ect.

[NR Browser] Instrument ResultView component

Summary

We need to instrument our ResultView component with NR Browser. We need to track the following events:

  • swiftypeSearchResult_click: occurs when a user clicks on a search result link

Properties that we want to record with this action:

  • href: link clicked
  • title: title of result clicked

AC

  • instrumented with NR browser agent
  • update spreadsheet with action name, additional properties, location implemented, ect.

[NR Browser] Instrument ContributingGuidelines component

Summary

We need to instrument our ContributingGuidelines component with NR Browser. We need to track the following events:

  • editThisPage_click: occurs when a user clicks on the "edit this page" button
  • createAnIssue_click: occurs when a user clicks on the "create an issue" button

Properties that we want to record with this action:

  • component: where this takes place, for this one it would be in page tools

AC

  • instrumented with NR browser agent
  • update spreadsheet with action name, additional properties, location implemented, ect.

[NR Browser] Instrument SwiftypeSearch component

Summary

We need to instrument our SwiftypeSearch component with NR Browser. We need to track the following events:

  • swiftypeSearch_input: occurs when a user searches

Properties that we want to record with this action:

  • search_terms: the text that they inputted when they searched
  • num_results: the number of results that came back from the search

AC

  • instrumented with NR browser agent

GlobalHeader is cut off by overflow:hidden on narrow viewports

Description

In mobile or narrow viewports, the GlobalHeader nav is being cut off in the middle of a nav item.

IMG_2137

Screen shot from iPhone 8, Safari browser, iOS 13.6.1

Steps to Reproduce

  • Load https://developer.newrelic.com/ on a mobile device or in Chrome using the iPhone 6/7/8 device emulator on via dev tools
  • Note in the upper right hand corner the word Community is cut off and the remaining nav items are not accessible

Expected Behaviour

Good question! I suppose I'd expect this either:

  1. to have a horizontal scroll
  2. to have only 2–3 items selectable, which all fit as full text
  3. to have a hamburger-icon and a mobile nav

Since most of the pages using this header will already have their own site-specific hamburger nav, you can probably rule our number 3.

Your Environment

  • iPhone 8, Safari browser, iOS 13.6.1

Additional context

[NR Browser] Instrument 404 page

Summary

We need to instrument our 404 page with NR Browser. We need to track the following events:

  • 404_redirect: occurs when the user is redirected to the 404 page

Properties that we want to record with this action:

  • path: path the user were trying to reach

AC

  • instrumented with NR browser agent
  • update spreadsheet with action name, additional properties, location implemented, ect.

Install and configure Lerna

When we merge PRs into main, we want to publish a new version of the package to NPM. Using Lerna, we can automate the creation of the changelog, update versions, and publish the package. Note that this will require a manual PR from develop to main.

Add language toggle to global header

Summary

Add a language toggle that switches the language context by changing the base url (docs.newrelic/en ==> docs.newrelic.com/jp)

Mock Up

Screen Shot 2021-01-04 at 3 14 06 PM

AC

  • Add optional language toggle to the global header
  • Switches the url based on the language toggle
  • Languages will be represented by language name

[NR Browser] Instrument SimpleFeedback component

Summary

We need to instrument our SimpleFeedback component with NR Browser. We need to track the following events:

  • feedback_click: occurs when a user clicks on one of the feedback buttons

Properties that we want to record with this action:

  • feedback: whether the feedback is positive or negative

AC

  • instrumented with NR browser agent
  • update spreadsheet with action name, additional properties, location implemented, ect.

Setup snyk

Like the developer site, let's setup snyk to validate our dependencies.

Add the <HamburgerMenu /> component

To ensure consistency, let's add the hamburger menu so that it can be consumed by all New Relic Gatsby sites.

According to the component audit we will want to use aspects of the design from both the developer website and the open source site.

Design requirements:

  • Make the hamburger menu smaller than its current size
  • Keep the colors used on the open source site in both light and dark modes
  • Use rounded instead of square corners like the developer site

Sign Up button on Dev / OSS site(s) should be Start Now

The Sign Up buttons to create an account should be more explicit relating to what the user is doing on our DECO sites on the Docs site: "Sign Up" makes sense but on the Dev site and OSS Site the button should be "Start Now".

Acceptance Criteria

  1. on the Docs Site, the sign up button should be sign up
  2. on the Dev Site, the sign up button should be start now
  3. on the OSS Site, the sign up button should be start now
  4. All URLs should point to the correct signup form and use the proper UTM source tag identifying where the user came from

Screen Shot 2020-12-29 at 10 31 48 AM

Add hover states for buttons

Description

We have buttons defined that can be used across New Relic Gatsby sites, but these buttons do not currently have hover states. We need to define hover states for buttons to better provide the experience that these buttons are interactive.

SEO component

The SEO component is used both in the OS site and the Dev Site, and likely will be used in the Docs site. We should factor this out into the theme.

AC

  • Component that adds SEO meta tags for our sites
  • Component added to the docs, oss, and dev site

[NR Browser] Instrument GlobalFooter component

Summary

We need to instrument our GlobalFooter component with NR Browser. We need to track the following events:

  • editThisPage_click: occurs when a user clicks on the "edit this page" button
  • createAnIssue_click: occurs when a user clicks on the "create an issue" button

Properties that we want to record with this action:

  • component: where this takes place, for this one it would be in global footer

AC

  • instrumented with NR browser agent
  • update spreadsheet with action name, additional properties, location implemented, ect.

Add the <SearchInput /> component

We have search inputs on both sites with similar treatment. Let's add this component so we can share both the implementation and the design.

According to the component audit, we want to use the design from the open source site, but with the added functionality of being able to clear the input with an x after typing, like on the developer website.

In addition to the designs, let's consider adding a size prop and allow the component to render as a large size which will match the size on the open source site

simplify the create Issue workflow to not require the use of github templates

With the Docs Site we decided to take a streamline approach to have the submit feedback button pass values in the URL using constants, which prevents the need to use a github issue template. This is very streamlined for a user, and it be cool to do this for the developer site as well and be consistent in our approach to creating issues on both sites.

code
https://github.com/newrelic/docs-website/pull/412/files/9d9091d5dbcf34c6eee855b3f89d7a9b92a53406#diff-22bbe242b6fb50d3a94108b9bf5c8b3df5f928f4d29dea68bc3f7e61d32ee26bR26

considerations

  • is this a theme level change or done for each site? Given the The OSS site may need additional issue templates.
  • does this makes sense to do for both the Docs Site and Dev Site?
  • why does the OSS Site need so many templates linked from create an issue? can we just by pass that.

current issue templates

Docs:
https://github.com/newrelic/docs-website/issues/new/choose

Dev Site:

https://github.com/newrelic/developer-website/issues/new/choose

OSS Site

https://github.com/newrelic/opensource-website/issues/new/choose

Add shared global styles

Both the developer site and the open source site should have similar global styles (box sizing, font size, etc). Let's add the shared global styles to this project.

Add an explorer's hub topic for support

To comply with our open source standards via the open source checklist, let's add an explorer's hub topic and link it in the README.

we will first need to update the NPM Package with details https://github.com/newrelic/gatsby-theme-newrelic

And given we don't have any pre-determined guidance for an npm package.

Will post something similar to what we do with the Nerdpacks which is grab some helpful bits from the README and treat it as an initial "press release" in a sense.

  • Screenshot + Intro, what is it and why would you want to use it
  • How to use it, install/setup (i.e. npm install)
  • Link to the repo

Add the ability to disable sitemaps

Description

To ensure a user cannot discover available pages on our private docs site, we need to ensure sitemaps are not created. Currently the theme is configured to always create a sitemap. We want this to be configurable.

I propose we add a new theme option that will allow us to disable this:

// gatsby-config.js
{
  resolve: '@newrelic/gatsby-theme-newrelic'
  options: {
    sitemap: false
    // ...
  }
}

Acceptance criteria

  • Add the option to disable sitemaps
  • Sitemaps should default to enabled

Documentation for global color variables

Documentation for global color variables

Summary

As noticed in a PR to our developer website, we don't have the best documentation surrounding our global color variables. I wonder if we would be able to link to our color guide / style guide so contributors creating new components are able to reference them!

Generate 3rd party notices

Like the developer site, we need to generate 3rd party notices to ensure we are using permissively licensed libraries.

Keep the dark mode / light mode setting across DECO site properties

We are using local storage to persist the value on each site. From my googling, it doesn’t look like you can share local storage between subdomains, for security reasons. We’d either have to use cookies (which I think allow you to share across subdomains), or we’d need to implement a common iframe that we can communicate with from each site.

By default, each site uses the user’s OS preference. Unless they’ve specifically switched it, they should have the same theme across the sites.

preferably we'd try and solve it via cookies/local storage so it serves everybody consistently.

[NR Browser] Instrument ExternalLink component

Summary

We need to instrument our ExternalLink and Link component with NR Browser. We need to track the following events:

  • externalLink_click: occurs when a user clicks on any external link

Properties that we want to record with this action:

  • href: link clicked

AC

  • instrumented with NR browser agent
  • update spreadsheet with action name, additional properties, location implemented, ect.

Consume variant, size, etc props as case insensitive

Description

When using the variant or similar props for components (such as Button) we expect the user to supply one of the exported types. That said, sometimes the content creators want to use a component and simply supply a string. In the case of the title prop for the <Callout> component, it expects a capitalized string (which is not initially obvious).

We should look through our components and ensure that the user can use an exported type or a string (regardless of casing).

use custom events to track stale issue data on Github

Add a custom event into dashboard so we can track stale issues, and how do we track data on stale issue, and time to resolution, etc. Before attempting to implement discuss with the OSS Team and DTK Team if they do this in anyway with Github actions or Git Hub Stats

Add site version to global footer component

Summary

The site version was displayed in the old OSS site footer, and it was cool but offered no utility and when we tried to apply it to the docs site, it was confusing as it wasn't clear what it was actually communication. So we removed it when we standardize the footer for all sites.

Screen Shot 2020-10-22 at 2 17 58 PM

Desired Behaviour

To actually make this useful and warrant it to be present in the global footer it would need to

  1. indicate it's a site version not docs version, or new relic product version.
  2. dynamically link to the current release tag on github so a user could click on it, and see the release notes for that version tag. ex: https://github.com/newrelic/opensource-website/releases/tag/v1.9.2
  3. be present in the footer under the footer logo image, vs being on the right side of the footer.

Create a base component that will form the foundation for the cards on each site

Based on a recent component audit from @djsauble, there are some similarities between the tile components used on both sites. While the design of the content itself differs, there is an opportunity to extract a base component that provides a container for content like this to live. This component would house the box shadows, background color, border, and text color of the card.

Recommendation: Call this component <Surface /> as this is a surface that sits on top of a background (inspiration from Material design)

[Build] Build one Callout component to rule them all

Summary

Build one Callout component in the theme that takes prop to specify which callout style it should render.

Acceptance criteria

  • As a developer I can use a Callout component and specify the type in a prop (tip, important, caution, permissions, pricing)

Add typography styles

To ensure consistency, we want to add all typography styles to the theme. These include:

  • Font families (primary, secondary, code)
  • Links
  • Primary and secondary text
  • Headers

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.