0.6.9 • Published 3 years ago

kron-ui v0.6.9

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Kron UI

Logo

Kron UI is a simple UI Framework that helps create beautiful Layouts, with simple Components. This is part of DataFrameworks Exam @ HIOF GROUP 18

Installation

npm install kron-ui
or
yarn add kron-ui

Getting Started

  • Vanilla Javascript
  • React

Vanilla JavaScript Setup

If you are unsure how to install, you will need a package manager. Easiest way is to install NodeJS to get Npm chances are you already have this installed aswell, you can check you version by writing node -v in the terminal. Make sure you have a version > 13. With Node you get npm.

npm init
or
yarn init

After initialization, install Kron-UI as shown in the installation above. And you can starting importing Kron-UI by refrencing to it with the script tag :

<script src="node_modules/kron-ui/dist/kron-ui/kron-ui.js"></script> 

Your <head> should look like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Awsome Site</title>
    <script src="node_modules/kron-ui/dist/kron-ui/kron-ui.js"></script>
</head>

Thats it! You have Kron UI setup in your project.

React Setup

Coming soon-

Components & Properties

All components uses the appearance attribute for their styles, and some have component specific attributes that is documentet for each component below.

Colors

Colors are used within the appearance property as well as for color intensity, example:

<kron-componenttype appearance='blue4'></kron-componenttype>

blue is the color and 4 is the intensity of the color blue. Put togheter we get blue4. All the colors have an intensity from 1 to 10.

Colors Available
  • Red
  • Blue
  • Green
  • Yellow
  • Pink
  • Brown
  • Grey
  • Gray

Components

Button

<kron-button>Im a button!<kron-button></kron-button></kron-button>

Button

Properties kron-button | properties | attributes | | ---------- | ------------------------------- | | appearance | color,b-color,h-color,bg-none |

attributesexamples
color = background colorblue10 : color + intensity(1-10)
b-color = border colorb-blue10 : b-color + intensity(1-10)
h-color = hover colorh-blue10 : b-color + intensity(1-10)
bg-none = no borderbg-none
Example usage
<kron-button appearance="blue7 b-blue3 h-green3">Styled Button!</kron-button>
<kron-button appearance="bg-none">Styled Button!</kron-button>

Menu

Menu is only activated by hovering for now.

  <kron-menu menu='Sort By'>
    <a href='=asc'>Ascending Order</a>
    <a href='=desc'>Descending Order</a>
  <kron-menu>

Menu

Properties kron-menu | properties | attributes | | ---------- | ------------------------------------------------------ | | appearance | color,b-color,h-color,sm,md,lg,font-sm,font-md,font-lg | | menu | "text" |

attributesexamples
color = background colorblue10 : color + intensity(1-10)
b-color = border colorb-blue10 : b-color + intensity(1-10)
h-color = hover colorh-blue10 : b-color + intensity(1-10)
sm = small button sizesm
md = medium button sizemd
lg = large button sizelg
font-sm = small font sizefont-sm
font-md = medium font sizefont-md
font-lg = large font sizefont-lg
  Example Usage
  <kron-menu menu='Sort By' appearance='blue3 b-blue5 h-green3 sm font-sm'>
  <a href='=asc'>Ascending Order</a>
  <a href='=desc'>Descending Order</a>
  <kron-menu>

Navbar

<kron-navbar> </kron-navbar>

Properties kron-navbar | properties | attributes | | ---------- | ------------------------------- | | appearance | color,hover-c, | | navlogo | "Text" | | contactlogo| "Text" |

attributesexamples
color = background colorblue10 : color + intensity(1-10)
hover-c = hover colorhover-b10 : hover color + intensity(1-10)
Example usage
<kron-navbar appearance="blue5 hover-b8" contactlogo="Contact us!" navlogo="Testpage">
  <a href="#"> Home </a>
  <a href="#"> Page 2 </a>
</kron-navbar>

Navbar

Box

<kron-box> </kron-box>

Properties kron-box | properties | attributes | | ---------- | ------------------------------- | | appearance | color,hover-c, flex-row-wrap, flex-column-wrap |

Attributes for kron-box | Attributes | Example | | ------ | ------- | | color = background color| blue10 : color + intensity(1-10) | | hover-c = hover color | hover-b10 : hover + color + intensity(1-10) | | flex-row-wrap | vertically placing the divs | | flex-column-wrap | horisontally placing the divs |

Example usage
 <kron-box appearance="flex-row-wrap blue1 hover-y10">
  <div> This</div>
  <div> is </div>
  <div> the same </div>
  <div> Component</div>
</kron-box>

<kron-box appearance="flex-column-wrap blue10 hover-r10">
  <div> as</div>
 <div>this one </div>
 

box

Article

<kron-article>
  <h2>header<h2>
  <p> lorum ispom</p>
</kron-article>

Article

Properties kron-article | properties | attributes | | ---------- | ------------------------------- | | appearance | serif, sans-serif, monospace, fantasy, large, medium, small, right, center, left, textRight, textLeft, textCenter |

attributesexplanationexample
serif = font-familyTimes New Roman + Times + serifsans
sans-serif = font-familyArial + Helvetica + sans-serifsans-serif
monospace = font-familyCourier New + Courier + monospacemonospace
fantasy = font-familyCopperplate + Papyrusfantasy
large = font-sizebig font sizelarge
medium = font-sizemedium font sizemedium
small = font-sizesmall font sizesmall
center left right = placement websitefloating center, floating left, floating rightcenter
color = background colorall the available colorblue10 : color + intensity(1-10)
textRight = text-align rightplaces in the right side of the article taggtextRight
textLeft = text-align leftplaces in the left side of the article taggtextLeft
textCenter = text-align Centerplaces in the middle side of the article taggtextCenter
<kron-article appearance="large serif center red1">
  <h2>header</h2>
  <p>lorum ipsom</p>
</kron-article>

Figure

<kron-figure></kron-figure>

Figure

Properties kron-figure | properties | attributes | | ---------- | ------------------------------- | | appearance | serif, sans-serif, monospace, fantasy right, center, left | | appearance-Image | radius, size | | img| src: enters image address | | alt| string value if image doesnt show | | appearance-Fig |figcaption-10 to figcaption-60 |

attributesexplanationexample
serif = font-familyTimes New Roman + Times + serifsans
sans-serif = font-familyArial + Helvetica + sans-serifsans-serif
monospace = font-familyCourier New + Courier + monospacemonospace
fantasy = font-familyCopperplate + Papyrusfantasy
radius = radius size imageradius-size10: radius intensity increasing 10 each time to 60radius-20
size = size imagesize increasing 10 each time to 60size-10
figcaption = center figacptionsize increase from 10 each time to 60figcaption-10
large = font-sizebig font sizelarge
medium = font-sizemedium font sizemedium
small = font-sizesmall font sizesmall
center left right = placement websitefloating center, floating left, floating rightcenter

|propterties in appearance-Fig| example | |img = src | put in image adresse | "https://imgcomfort.com/Userfiles/Upload/images/illustration-geiranger.jpg" |alt = alt for descriping the image | "change text inside quotation marks" |

<kron-figure
  appearance="center"
  appearance-Image="size-40"
  appearance-Fig="figcaption-40"
  img="https://imgcomfort.com/Userfiles/Upload/images/illustration-geiranger.jpg"
  text="bilde fra fjell"
>
</kron-figure>

Form

<kron-form></kron-form>

Form

Properties kron-form | properties | attributes | | ---------- | ------------------------------- | | appearance | serif, sans-serif, monospace, fantasy right, center, left, large, medium, small | | image |true = having picture, false = remove picture |

attributesexplanationexample
serif = font-familyTimes New Roman + Times + serifserif
sans-serif = font-familyArial + Helvetica + sans-serifsans-serif
monospace = font-familyCourier New + Courier + monospacemonospace
fantasy = font-familyCopperplate + Papyrusfantasy
radius = radius size imageradius-size10: radius intensity increasing 10 each time to 60radius-30
size = size imagesize increasing 10 each time to 60size 30
large = font-sizebig font sizelarge
medium = font-sizemedium font sizemedium
small = font-sizesmall font sizesmall
center left right = placement websitefloating center, floating left, floating rightcenter

Nesting comopnents kron-form show you the ability for nestin the components. Its importants that you add div slot="name" for adding kron-figure inside the form or whant get the kron-figure to work. Remember that you can follow the documentation for the kron-figure for adding styling for the component.

<kron-form appearance="large serif center" image="true">
  <div slot="start">
    <kron-figure slot="img" appearance="center" img="https://imgcomfort.com/Userfiles/Upload/images/illustration-geiranger.jpg" appearance-Image="size-40 radius-50" />
  </div>
  <h2>registrer bruker</h2>
  <input type="text" name="fornavn" placeholder="  Fornavn" required />
  <button>knapp</button>
</kron-form>

Adding it all up

Adding all the different components togheter creating a our own example ecommerce page. Code: https://pastebin.com/QfxSngAA

All

0.6.6

3 years ago

0.6.9

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.5

3 years ago

0.6.4

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.4

3 years ago

0.0.1

3 years ago