This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, this is my first gist... | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import styled from 'styled-components' | |
class ScrollingWrapper extends React.Component { | |
state = { hasScrolled: false } | |
componentDidMount() { | |
this.scrollingWrapper.addEventListener('scroll', this.onScroll) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import styled from 'styled-components' | |
export default class BasicToggler extends React.Component { | |
state = { | |
isToggled: false | |
} | |
toggle = () => { | |
this.setState(state => ({isToggled: !state.isToggled})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import styled from 'styled-components' | |
//---------------------------------------------------------------------------------- | |
// Reusable Toggler Component | |
//---------------------------------------------------------------------------------- | |
class Toggler extends React.Component { | |
state = { | |
isToggled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class Toggler extends React.Component { | |
state = { | |
isToggled: false | |
} | |
toggle = () => { | |
this.setState(state => ({isToggled: !state.isToggled})) | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import styled from 'styled-components' | |
import Component2 from './component2' | |
const initialValue = { | |
message: "This is my message from context" | |
} | |
export const MyContext = React.createContext(initialValue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql } from 'apollo-boost' | |
const RECIPE_ATTRIBUTES = gql` | |
fragment recipeResults on Recipe { | |
id | |
title | |
directions | |
ingredients | |
bylines { | |
id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const GET_RECIPES = gql` | |
query Search($searchInput: String!) { | |
search(q: $searchInput, brand: FOOD, types: RECIPE, limit: 50) { | |
count | |
pageInfo { | |
endCursor | |
hasNextPage | |
} | |
results { | |
results { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const GET_RECIPE = gql` | |
query Search($id: String!) { | |
search(q: $id, brand: FOOD, types: RECIPE) { | |
results { | |
...on Recipe { | |
id | |
title | |
directions | |
ingredients | |
bylines { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql } from 'apollo-boost' | |
const RECIPE_ATTRIBUTES = gql` | |
fragment recipeAttributes on Recipe { | |
id | |
title | |
directions | |
ingredients | |
bylines { | |
id |
OlderNewer