4.1.2 • Published 7 months ago

@kesval/design v4.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@kesval/design

Motivation

Why'd I make this ? I need something to style my projects, and that's consistent across all of them. Now, there's cool libraries out there that could help me do that but I never really liked them. This library aims to be very accessible by using semantics a lot, and also wants to be easy to use, without ever over styling something so it can be modified in the final project.

You should never need to use more than one class on an element, and if you do, it's for very specific things, such as an outline primary button, which would be <button class="primary outline">. Otherwise, everything should be as clear as day in your classes.

Semantics ?

Yes. For example, if you want to create a card, you wouldn't do something like this :

<div class="card">
  <div class="card-header">
    header content
  </div>
  <div class="card-content">
    card content
  </div>
  <div class="card-footer">
    card footer
  </div>
</div>

This is not semantic, nor accessible, and it's not always easy to remember what class to use. With my package, you would instead do this :

<div class="card">
  <header>
    header content
  </header>
  <section>
    card content
  </section>
  <footer>
    something footer
  </footer>
</div> 

As you can see, it requires only one class and the rest is pure HTML. This also forces you to use the correct HTML tags, which is good for accessibility.

Classes

Classes are still available to use if you want to style something specific. For example, you most likely would sometimes want a button that is a link, and I won't link the button component to the a tag. So how do you do it ? Well, for every component, its name is also a class. So if you want a button that is a link, you would do this :

<a class="button" href="#">Link button</button>

Usage

To use this library, install it via npm:

npm install @kesval/design

Then import it in your project:

import '@kesval/design';

This will import everything that is standard css, so this is only for static things, such as the base (general, reset, etc.). But, you will probably need to use the utilities (media-query for example), and you can import them like this with Vite (recommended) :

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { resolve } from 'path';

export default defineConfig({
 plugins: [sveltekit()],
 css: {
  preprocessorOptions: {
   scss: {
    additionalData: '@use "node_modules/@kesval/design/scss/utilities" as u;'
   }
  }
 }
});

Now you can use the utilies everywhere prefixed with u., for example, @include u.mq(md) { ...code }.

Why is X not included ?

I want to keep the package lightweight and only include things that I use in every project. Everything else that I need that, for example, requires JavaScript (such as a dropdown), I will have in my SvelteKit Starter. You might want to check it out, everything is already set up for you. Even internationalization.

Fonts

Font names are defined in utilities/typography.scss, but they are not imported. I leave it up to you to import the fonts you need in your project and define the font-faces with the correct font-family name. This is so you choose where you want to import your fonts from (Google Fonts, Self hosted, etc.).

Default fonts are Benzin for titles or important things and default ui font for everything else. In this package, I only use 700 for Benzin and 400, 500 and 700 for the default ui font.

Animations

A lot of components have animations that are turned on by default. If for some reason you want to turn them off, just add the clas no-anim to the component. I recommend you keep them on since they're not intrusive and they make the website feel more alive.

Ressources

4.1.2

7 months ago

4.1.1

7 months ago

4.1.0

7 months ago

4.0.0

7 months ago

3.1.2

8 months ago

3.1.1

8 months ago

3.1.0

9 months ago

3.0.2

9 months ago

3.0.1

9 months ago

3.0.0

9 months ago

2.3.1

9 months ago

2.3.0

9 months ago

2.2.1

9 months ago

2.2.0

9 months ago

2.1.1

9 months ago

2.1.0

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.8.1

10 months ago

1.8.0

10 months ago

1.7.0

10 months ago

1.6.1

10 months ago

1.6.0

10 months ago

1.5.3

10 months ago

1.5.2

10 months ago

1.5.1

10 months ago

1.5.0

10 months ago

1.4.4

10 months ago

1.4.3

10 months ago

1.4.2

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.3.0

10 months ago

1.2.0

10 months ago

1.1.0

10 months ago

1.0.0

10 months ago