GithubHelp home page GithubHelp logo

Comments (3)

magicink avatar magicink commented on May 28, 2024

Sorry for taking so long to get back to you! Upon reading the documentation, I realize I documented this feature incorrectly and I will be publishing a new version shortly. As for the task you outlined, Here's how you would accomplish this:

// @flow
import React from 'react'
import styled, { ThemeProvider } from 'styled-components'
import Neat, {gridColumn, gridMedia, gridContainer} from '../../bundle'

const mobileGrid = Neat({
  columns: 12,
  gutter: '10px',
  media: 'only screen and (max-width: 600px)'
})

const desktopGrid = Neat({
  columns: 12,
  gutter: '20px',
  media: 'only screen and (min-width: 601px)'
})

const Column = styled.div`
  height: 50px;
  background-color: yellow;
  margin-top: 1rem;
  ${gridColumn(mobileGrid, 2)}
  ${gridMedia(desktopGrid, [
    {
      ...gridColumn(desktopGrid, 1),
      'background-color': 'red'
    },
  ])}
`

const Container = styled.div`
  ${gridContainer()}
`

export class GridMedia extends React.Component {
  render () {
    return [
      <h1 key={'header'}><code>gridMedia</code></h1>,
      <ThemeProvider key={'provider'} theme={Neat()}>
        <Container>
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
          <Column />
        </Container>
      </ThemeProvider>
    ]
  }
}

Essentially gridMedia is going to take a theme and then inject the CSS object in the array. There's a bug here because it's only detecting the first argument. This will be fixed shortly, but in the meanwhile the example above should work.

I'm going to include this example in the updated docs as well as with demos I'm including.

Thanks for your feedback.

from neat-components.

magicink avatar magicink commented on May 28, 2024

I've included a demo in the repo. You can run the demo by running npm run build:demo followed by npm run start:demo

from neat-components.

dac09 avatar dac09 commented on May 28, 2024

Thanks 👍 I'll give it ago soon

from neat-components.

Related Issues (4)

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.