Giter Club home page Giter Club logo

vite-styles's Introduction

React + TypeScript + Vite

What's this?

This is a react + vite starter template but uses tenoxui css framework for styling.

How's it looks like

This is how the new style looks like :

import tenoxui, { use, makeStyles } from "tenoxui";
import property from "@tenoxui/property";

const styles = () => {
  use(property);

  makeStyles({
    body: "m-0 d-flex place-items-center w-mn-320px h-mn-100vh",
    "#root": "w-mx-1280px mh-auto"
    // more styles
  });

  tenoxui();
};

Here's the breakdown :

  1. Import all necessary module
import tenoxui, { use, makeStyles } from "tenoxui";
import property from "@tenoxui/property";
  1. What is property?
import property from "@tenoxui/property";

const styles = () => {
  use(property);

  // other code
};

property can optionally imported if you don't wanna re-define your types and properties manually. The property is basically bunch of types and properties that already defined before and you can just include it to your project.

  1. use function

use is a function can store your types and properties. It will make sure the functions like makeStyles() and tenoxui() knows which class names they need to process or can processed.

use({ c: "color", fs: "fontSize" });

After added some types and properties inside of it, you can immediately use the types as prefix class to your element :

<h1 class="c-#ccf654 fs-3rem">Hello World!</h1>
  1. makeStyles function
makeStyles({
  body: "bg-red",
  "p.text": "fs-0.8rem"
  // more
});

This function allows you to give styles using specific selectors.

  1. Applying the styles
import { useLayoutEffect } from "react";

function App() {
  useLayoutEffect(() => {
    tenoxui({ c: "color", fs: "fontSize" });
  }, []);
  
  return <h1 className="c-#ccf654 fs-3rem">Hello World!</h1>
}

Not sure about this method, but it fast for developing your apps, styles will be applied to your element after a change to the className. The useLayoutEffectvery rarely used rather than useEffect. But, since tenoxui is using DOM to handle the styling, useLayoutEffect make sure the style applied at the right time. Thanks :D

Getting Started with TenoxUI

Add tenoxui to your project

Install tenoxui using npm or whatever you have :

npm i tenoxui --save-dev

Include tenoxui to your project

Here's a simple configuration on your App.jsx file :

import { useLayoutEffect } from "react";
import tenoxui from "tenoxui";

const App = () => {
  useLayoutEffect(() => {
    tenoxui({ c: "color" });
  }, []);

  return <h1 className="c-#ccf654">Hello World!</h1>;
};

export default App;

Resources

vite-styles's People

Contributors

nousantx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.