Skip to content

Commit

Permalink
docs: ✏️ added general getting started files (#764)
Browse files Browse the repository at this point in the history
* feat: added general getting started files

* Update howto-angular.md

* Update howto-react.md

* Update howto-vue.md

* chore: wording

* Update howto-react.md

* chore: corrected product name

* fix: some corrected path

* refactor: removed that unnecessary sentence

* fix: corrected imports

* docs: update getting-started.md

* docs: update getting-started.md

---------

Co-authored-by: Nicolas Merget <[email protected]>
Co-authored-by: NicolasMerget <[email protected]>
  • Loading branch information
3 people authored Mar 20, 2024
1 parent 5d7936d commit 1a00b1e
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 0 deletions.
30 changes: 30 additions & 0 deletions output/angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,36 @@ import { DBButton } from '@db-ui/ngx-components';
<db-button variant="primary">Button</db-button>
```

### Events

There are 3 ways to use Events in Angular:

**[ngModel](https://angular.io/api/forms/NgModel)**

```html
<DBInput label="Inputfield" name="input-name" [(ngModel)]="input"></DBInput>
```

**[FormControl](https://angular.io/api/forms/FormControl)**

```html
<DBInput
label="Inputfield"
name="input-name"
[formControl]="inputControl"
></DBInput>
```

**[change](https://developer.mozilla.org/de/docs/Web/API/HTMLElement/change_event)**

```html
<DBInput
label="Inputfield"
name="input-name"
(change)="input = $event.target.value"
></DBInput>
```

## Custom Events

We do not provide every event on every component. If you are missing an event please [add an issue](https://github.com/db-ui/mono/issues).
Expand Down
24 changes: 24 additions & 0 deletions output/vue/vue3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@ import "@db-ui/v-components/dist/style.css";
</template>
```

### Events

We add `v-model` support which fires on every change.
But you can use normal `@` events as well.

Both Inputs in this example do the same:

```html
<script setup lang="ts">
import { DbInput } from "@db-ui/v-components";
import { ref } from "vue";
const input = ref("");
</script>
<template>
<DBInput label="Inputfield" name="input-name" v-model="input"></DBInput>
<DBInput
label="Inputfield"
name="input-name"
:value="input"
@change="e => input = e.target.value"
></DBInput>
</template>
```

## Custom Events

We do not provide every event on every component. If you are missing an event please [add an issue](https://github.com/db-ui/mono/issues).
Expand Down
2 changes: 2 additions & 0 deletions packages/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ A library containing all styles for components of [DB UX Design System (technica

Please take a look at your desired framework to retrieve more information.

For additional information besides the frameworks see our [Getting started](https://github.com/db-ui/mono/tree/main/packages/components/docs/getting-stated.md).

---

If you just need the styling follow this:
Expand Down
90 changes: 90 additions & 0 deletions packages/components/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Getting started

## Purpose

You're a Web Developer and you want to use DB UI Components in your own application, whether it's integrating HTML or using our provided Angular, Vue and React components.

In case of the latter, you could directly head over to our JavaScript framework components description:

- [Angular components](https://www.npmjs.com/package/@db-ui/ngx-components)
- [React components](https://www.npmjs.com/package/@db-ui/react-components)
- [Vue components](https://www.npmjs.com/package/@db-ui/v-components)

## Options

There are multiple options how to use DB UI Components:

- Manually copy the artifacts to your project
- Use npm package

## How to use

Download `@db-ui/components` package to get the compiled CSS and source code, or include it with npm package manager (repository on _npmjs.com_ or _yarn_).

Previous to that you would need to have `node.js` installed on your local machine. In case you haven't, we recommend installing `node` via [`nvm`](https://github.com/nvm-sh/nvm).

### Use _npmjs.com_ or _yarn_ (installing npm package, recommended)

In case you'd like to use DB UI Components as a dependency in your (frontend) build process and you even also care about handling DB UI Components as a dependency (e.g. for updates etc.), you need to install it as a dependency to your project and then link it within your HTML (CSS file) or within your SCSS.

```shell
npm i --save @db-ui/components
```

This should add a new entry to your `package.json` file:

```json
"dependencies": {
"@db-ui/components": "^x.y.z"
}
```

- You will find the relevant files at `node_modules/@db-ui/components`
- Copy the `assets` folder from `node_modules/@db-ui/foundations/assets` and the `styles` folder from `node_modules/@db-ui/components/build/styles/` to your application directory or link them. Most of the build tools support automatic copying.

### Download or CDN references

You could as well download all the files that you would elsewhere retrieve via the node package directly or reference them from a CDN, as provided by the several different services listed e.g. at [@db-ui/components](https://yarnpkg.com/package/@db-ui/components).

### Integration

The integration depends on your tech stack and varies from copying the files from `node_modules/@db-ui/components/build`, through using a bundler like webpack or rollup to using a framework that totally abstracts that part away from your workflow.

#### Via HTML stylesheet include

```html
<link rel="stylesheet" href="<PATH>/db-ui-42.css" type="text/css" />
```

#### Via SCSS import

```scss
@use "@db-ui/components/build/styles/db-ui-42";
```

### SCSS: node_modules include path / load path

Please keep in mind, that you would need to set your `include path` also known as `load path` depending on your setup for the sass compiler to find the correct `node_modules` folder, e.g. like the following (this is similar to how other frameworks and libraries like [Bootstrap](https://github.com/twbs/bootstrap-npm-starter/blob/main/package.json#L18) are handling this):

#### [`sass` compiler](https://npmjs.com/sass)

```json
{
"scripts": {
"css-compile": "sass --load-path=node_modules style.scss:style.css"
}
}
```

---

#### [`node-sass` Compiler](https://npmjs.com/node-sass)

```json
{
"scripts": {
"css-compile": "node-sass --include-path node_modules style.scss -o assets/css/"
}
}
```

0 comments on commit 1a00b1e

Please sign in to comment.