Ugnay Components Web
- The web implementation of SurPath Hub's design system
Component documentation lookup
Prerequisites
- NPM
- Sass Preprocessor (or some build pack like Webpack or Gulp)
- Knowledge about basic HTML, CSS, JS, and SCSS
Basic Usage
- Now, we need to know how to use the components in our project for the library to work (duh.)
- So here's the basic usage for the HTML portion of the library:
HTML Usage
- Go to this library's documentation page/s
- Select the component that you want.
- Copy its HTML code.
- Paste it in your project's html page/s.
- Enjoy!
- Now these HTML components are very dull in and of its own. We need to add styles.
- At the next section of this Basic Usage portion, we'll be showing you the basic usage of the library's SCSS modules.
SCSS/CSS Usage
- Install the modules using npm:
npm install @surpathhub/ugnay
1A. Alternatively, you can instantiate the component styles using the official CDN
<link rel="stylesheet" href="https://unpkg.com/@surpathhub/ugnay@0.1.0-beta/main.css">
- Import all the components that you want to use in your project.
@use '~@surpathhub/ugnay/SPHCore/Theme';
@use '~@surpathhub/ugnay/SPHButton';
@use '~@surpathhub/ugnay/SPHTextField';
2A. Alternatively, if you write in CSS directly, you can use the @import url()
at-rule.
@import url('https://unpkg.com/@surpathhub/ugnay@0.1.0-beta/[component_name]/main.css');
/*
Examples:
@import url('https://unpkg.com/@surpathhub/ugnay@0.1.0-beta/SPHAppbar/main.css');
@import url('https://unpkg.com/@surpathhub/ugnay@0.1.0-beta/SPHButton/main.css');
@import url('https://unpkg.com/@surpathhub/ugnay@0.1.0-beta/SPHHeader/main.css');
@import url('https://unpkg.com/@surpathhub/ugnay@0.1.0-beta/SPHTextField/main.css');
*/
- Call the component styles using the
use()
mixin.
...
@include SPHComponent.use();
- DONE!
TypeScript Usage
- Import the typescript module of the component you want to use.
import SPHNavbar from "@surpathhub/ugnay/Components/SPHNavbar";
- Make a new instance of that component.
import SPHNavbar from "@surpathhub/ugnay/Components/SPHNavbar";
const myNavbar = new SPHNavbar();
- Attach
.use()
at the end of the instance variable.
import SPHNavbar from "@surpathhub/ugnay/Components/SPHNavbar";
const myNavbar = new SPHNavbar();
myNavbar.use();
- Let your compiler do its thing.
- Done!