How to use atomic-layout - 7 common examples

To help you get started, we’ve selected a few atomic-layout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kettanaito / atomic-layout / examples / Playground / PeriodExample.jsx View on Github external
import React from 'react'
import Layout, { Composition } from 'atomic-layout'

Layout.configure({})

const templateBox = `
thumbnail
heading
channelName
meta
`

const templateRow = `
thumbnail heading heading
thumbnail channelName meta
thumbnail description description
`

const Video = ({ isBox, title, channelName, views, description }) => (
github kettanaito / atomic-layout / examples / configuration / CustomUnit.jsx View on Github external
componentWillMount() {
    Layout.configure({
      defaultUnit: 'rem',
    })
  }
github kettanaito / atomic-layout / examples / configuration / CustomBreakpoints.jsx View on Github external
componentWillMount() {
    Layout.configure({
      defaultUnit: 'rem',
      defaultBreakpointName: 'mobile',
      breakpoints: {
        mobile: {
          maxWidth: '575px',
        },
        tablet: {
          minWidth: '576px',
          maxWidth: '768px',
        },
        desktop: {
          minWidth: '769px',
        },
      },
    })
  }
github kettanaito / atomic-layout / examples / hooks / UseViewportChange.jsx View on Github external
useViewportChange(() => {
    setVisibility(
      matchMedia(`(min-width: ${Layout.breakpoints.lg.minWidth})`).matches,
    )
  })
github kettanaito / atomic-layout / packages / atomic-layout / examples / hooks / UseResponsiveComponent.jsx View on Github external
import React from 'react'
import styled from 'styled-components'
import { useResponsiveComponent } from 'atomic-layout'

const Text = useResponsiveComponent(
  styled.h1`
    color: ${({ color }) => color};
    font-size: ${({ size }) => size}px;
  `,
)

const Scenario = () => {
  const textRef = React.useRef({})
  const [refDerivedData, setRefDerivedData] = React.useState(null)

  React.useEffect(() => {
    setRefDerivedData(textRef.current.id)
  }, [textRef.current])

  return (
    <div></div>
github kettanaito / atomic-layout / examples / hooks / UseResponsiveProps.jsx View on Github external
const Element = (props) =&gt; {
  const { size, showBadge, fontSize } = useResponsiveProps(props)

  return (
    <div style="{{" id="element">
      
        {showBadge &amp;&amp; }
      
    </div>
  )
}
github kettanaito / atomic-layout / examples / hooks / UseResponsiveValue.jsx View on Github external
const UseResponsiveValue = () =&gt; {
  const text = useResponsiveValue(
    {
      xs: 'xs',
      md: 'md',
      lg: 'lg',
    },
    'default',
  )

  return {text}
}

atomic-layout

Physical representation of layout composition to create declarative, responsive layouts in React.

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis