GithubHelp home page GithubHelp logo

viivue / atomic-css Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 188 KB

⚛️ Customizable Atomic CSS Framework for everyone.

License: MIT License

CSS 23.56% SCSS 76.44%
atomic-css scss css-framework stacks css sass

atomic-css's Introduction

Atomic CSS

npm minified jsdelivr license

⚛️ Customizable Atomic CSS Framework for everyone.

We all might agree that Atomic CSS is a helpful tool for both FE and BE development. There's a lot of Atomic CSS frameworks out there (like tailwindcss), however, to elevate the advantage of Atomic CSS, while keeping it in as light-weight as possible, and even customizable for each project, we have this project on the go.

Usage

NPM

Install NPM package with basic config

npm i @viivue/atomic-css

Import

import "@viivue/atomic-css";

Or, you can download the default Atomic CSS files in the /dist folder.

CDN

Check the CDN served by jsDelivr here

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/viivue/[email protected]/dist/atomic.min.css">

Customization

To add custom classes for a specific project, you will have to:

  1. Clone this repo to your local machine.
  2. Edit the /scss/_config.scss, you will find some example templates there.
  3. Generate the new Atomic CSS by npm run prod.

Deployment

npm install

# Watch SCSS files, then compile to previewed CSS
npm run dev

# Compile compressed CSS for distribution.
# Check version at `_defs.scss` and `package.json`
npm run prod

# Publish NPM package
# Auto-publish package on release using GitHub workflow
npm publish

atomic-css's People

Contributors

phucbm avatar vandangnhathung avatar vuquangpham avatar

Watchers

 avatar

atomic-css's Issues

feat: container sizes

Create options to add multiple container sizes, and provide related CSS variables and classes.

Usage demo:

/* variables */
:root {
    /* Container */
    --bb-container:1076px;
    --bb-container-large:1196px;
    --bb-container-xl:1290px;
}

/* Container */
.container, .container-large, .container-xl {
    position:relative; width:100%; max-width:calc(var(--bb-container) + var(--bb-gap-container) * 2);
    margin-right:auto; margin-left:auto;
    padding-right:var(--bb-gap-container); padding-left:var(--bb-gap-container);
}
.container {max-width:calc(var(--bb-container) + var(--bb-gap-container) * 2);}
.container-large {max-width:calc(var(--bb-container-large) + var(--bb-gap-container) * 2);}
.container-xl {max-width:calc(var(--bb-container-xl) + var(--bb-gap-container) * 2);}

Add Border radius

Ref: https://stackoverflow.design/product/base/border-radius/

Only create classes for what's inside this table.

Abbreviation Output Definition
.bar-pill border-radius: 1000px Apply a border radius of 1000px to each corner for a 100% rounding of the left and right corners
.bar-circle border-radius: 100% Apply a border radius of 100% to each corner circular appearance
.bar0 border-radius: 0 Apply a border radius of 0 to all corners
.bar3 border-radius: 3px Apply a border radius of 3px to all corners
.bar5 border-radius: 5px Apply a border radius of 5px to all corners
.bar10 border-radius: 10px Apply a border radius of 10px to all corners
.bar15 border-radius: 15px Apply a border radius of 15px to all corners

specific transition properties

Why

We need to specify the transition properties instead of using transition:all in order to bypass the "avoid non-composited animations" issue from Lighthouse.

Screenshot 2023-05-23 at 15 30 17

How

.t-transform {transition-property: transform;}
.t-transform-opacity {transition-property: transform, opacity;}
.t-transform-opacity-color {transition-property: transform, opacity, color;}
.t-transform-color {transition-property: transform, color;}
.t-opacity-color {transition-property: opacity, color;}
.t-opacity {transition-property: opacity;}
.t-color {transition-property: color;}

Ref

🚐 Road map

At the end of this road map, we will have a responsive and customizable atomic CSS framework.

To avoid reinventing the wheel, we would follow the naming structure of Stacks.

Checklist

  • Display
  • Spacing vertical
  • Spacing horizontal
  • Font size
  • Positioning
  • Typography
  • Flex
  • Background
  • Object fit
  • Transitions
  • Color

add visually hidden

We need this to leverage the support to a11y.

/* Visually hidden */
.visually-hidden {
    position:absolute;overflow:hidden;clip:rect(0 0 0 0);
    width:1px;height:1px;margin:-1px;padding:0; border:0;
}

Read more in this article.

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.