Giter Site home page Giter Site logo

atomic-layout-docs's Introduction

Introduction

Atomic Layout is a spatial distribution library for React. It uses CSS Grid to define layout areas and render them as React components_._ You control spacing between the areas in a dedicated layer called Composition. Since the position and spacing is contextless that way, you achieve ultimate separation of concerns and boost maintenance of your components.

Encouragements

To understand why Atomic Layout is beneficial for you take a look at some of the practices it encourages:

  • Separation of concerns. What elements are rendered and what is the relation between them are now two independent paradigms in your code. Forget about CSS hacks and contextual tweaks.
  • Composition as a physical component. We build applications with composability in mind. Adopted from the design world, we, engineers, can wield the power of composition because it's an actual React component. "A page is a composition of header, body, and footer"β€”that's not just an explanation from a designer anymore, but an actual code you would write. Literally:
import React from 'react'
import { Composition } from 'atomic-layout'

const areas = `
  header
  body
  footer
`

export const Page = () => (
  <Composition areas={areas}>
    {({ Header, Body, Footer }) => (
      <>
        <Header>{...}</Header>
        <Body>{...}</Body>
        <Footer>{...}</Footer>
      </>
    )}
  </Composition>
)
  • Unification at any scale. Any component written with Atomic Layout has the same declaration structure. Browsing such code is quick, refactoring is predictable, and maintenance is painless.

Getting started

We've prepared a full-scale tutorial where you will be creating a set of UI elements using Atomic Layout. That's a great place to get started with the library.

{% page-ref page="getting-started/installation.md" %}

Motivation

One of the most popular ways to create layout nowadays is to combine a set of small, reusable components, often called "atoms", into a meaningful layout unit. Naturally, atoms have spacial relation between each other, which often depends on the context they are being rendered. However, when it comes to implementing this relation we often describe it, and all its variations, directly in the atom components, making them irreversibly contextual. Suddenly a plain button has a dozen of margin variations when in fact it should not be aware in which context it's included.

The issue lies in the luck of standardized way to describe relation between layout units. Don't get me wrong: there are plenty of techniques and features in CSS, yet they are rather tools than concepts.

This is why I've build Atomic Layout: to have a single spacial distribution layer, both conceptually and physically. It's meant to be a shell that controls how its children relate using concise declarative API. It uses powerful CSS features (i.e. CSS Grid) and provides you a high-level layout API, just as React uses DOM operations and gives you API of its own. That way I hope to encourage best practices and make UI development easy and fun.

{% page-ref page="motivation.md" %}

Not convinced yet?

  • Lightweight (~4 Kb gzipped);
  • Based on the standardized CSS Grid (no hacks or polyfills);
  • Supported in 93+% of browsers worldwide;
  • Comes with versatile responsive API and useful React hooks;

Getting started

{% page-ref page="getting-started/installation.md" %}

atomic-layout-docs's People

Contributors

erikras avatar juandc avatar kettanaito avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

atomic-layout-docs's Issues

Sandbox doesn't work

When I look at the getting started section's first sandbox, it doesn't work.

I see the main index.js is nested, not at the root, and couldn't find how it can be changed. It would be a lot nice to make it work for us users without changing or working on the examples.

JS.ORG CLEANUP

JS.ORG CLEANUP

Hello, it seems a js.org subdomain that was requested to target this repository no longer works.
The subdomain requested was atomic-layout.js.org and had the target of kettanaito.github.io/atomic-layout-docs.
It produced the following failures when tested as part of the cleanup:

  • HTTP: Failed with status code '404 Not Found'
  • HTTPS: Failed with status code '404 Not Found'

To keep the js.org subdomain you should add a page with reasonable content within a month so the subdomain passes the validation.
Failure to rectify the issues will result in the requested subdomain being removed from JS.ORGs DNS and the list of active subdomains.

If you are wanting to keep the js.org subdomain and have added reasonable content, YOU MUST reply to the main cleanup issue with the response format detailed at the top to keep the requested subdomain.

πŸ€– Beep boop. I am a robot and performed this action automatically as part of the js.org cleanup process. If you have an issue, please contact the js.org maintainers.

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.