Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blidblid committed Aug 10, 2024
1 parent 686746c commit d516677
Show file tree
Hide file tree
Showing 13 changed files with 2,331 additions and 2,921 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ testem.log
.DS_Store
Thumbs.db

# Caches
.angular

.nx/cache
.nx/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# berg-layout

Check out the usage and demo [here](https://berglayout.com/).
- Usage and demo [here](https://berglayout.com/).
- @berg-layout/core [here](https://github.com/blidblid/berg-layout/tree/main/libs/core)
- @berg-layout/angular [here](https://github.com/blidblid/berg-layout/tree/main/libs/angular)
- @berg-layout/react [here](https://github.com/blidblid/berg-layout/tree/main/libs/react)
6 changes: 2 additions & 4 deletions apps/demo/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/demo",
"index": "apps/demo/src/index.html",
"main": "apps/demo/src/main.ts",
"browser": "apps/demo/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/demo/tsconfig.app.json",
"assets": ["apps/demo/src/favicon.ico", "apps/demo/src/assets"],
Expand All @@ -39,9 +39,7 @@
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/app/home/home.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: flex;
flex-direction: column;
align-items: center;
padding-top: 15%;
padding-top: 24vh;
position: fixed;
top: 0;
bottom: 0;
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/lib/components/toolbar/toolbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
</div>

<div class="flex">
<a mat-button routerLink="/">
<a mat-icon-button routerLink="/">
<mat-icon svgIcon="home"></mat-icon>
</a>

<button mat-button (click)="toggleRight()">
<button mat-icon-button (click)="toggleRight()">
<mat-icon svgIcon="menu"></mat-icon>
</button>
</div>
Expand Down
8 changes: 2 additions & 6 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"hosting": {
"public": "dist/apps/demo",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"public": "dist/apps/demo/browser",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
Expand Down
23 changes: 23 additions & 0 deletions libs/angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,26 @@ Usage and demo [here](https://berglayout.com/angular).

- Panel inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/panel/panel-model.ts)
- Layout inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/layout/layout-model.ts)

## Styling

Since berg-layout uses web components, the layout styles are encapsulated in the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM).

You can still style them, but you need to use the pseudo element [::part()](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) to pierce the encapsulation.

### Styling panels

The panels have two `::part()`

- `part="content"` which wraps your content
- `part="overflow"` which handles overflow and wraps `content`

To for example, style `content`, use `::part`

```css
.berg-panel-top {
&::part(content) {
padding: 16px;
}
}
```
23 changes: 23 additions & 0 deletions libs/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,26 @@ Usage and demo [here](https://berglayout.com/core).

- Panel inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/panel/panel-model.ts)
- Layout inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/layout/layout-model.ts)

## Styling

Since berg-layout uses web components, the layout styles are encapsulated in the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM).

You can still style them, but you need to use the pseudo element [::part()](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) to pierce the encapsulation.

### Styling panels

The panels have two `::part()`

- `part="content"` which wraps your content
- `part="overflow"` which handles overflow and wraps `content`

To for example, style `content`, use `::part`

```css
.berg-panel-top {
&::part(content) {
padding: 16px;
}
}
```
2 changes: 1 addition & 1 deletion libs/core/src/lib/components/panel/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
withLatestFrom,
} from 'rxjs/operators';
import { coerceBooleanProperty, coerceNumberProperty } from '../../util';
import { BergLayoutElement, BERG_LAYOUT_TAG_NAME } from '../layout';
import { BERG_LAYOUT_TAG_NAME, BergLayoutElement } from '../layout';
import {
BERG_LAYOUT_NO_TRANSITION_CLASS,
BERG_LAYOUT_RESIZING_HORIZONTAL_CLASS,
Expand Down
23 changes: 23 additions & 0 deletions libs/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,26 @@ Usage and demo [here](https://berglayout.com/react).

- Panel inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/panel/panel-model.ts)
- Layout inputs and outputs [here](https://github.com/blidblid/berg-layout/blob/main/libs/core/src/lib/components/layout/layout-model.ts)

## Styling

Since berg-layout uses web components, the layout styles are encapsulated in the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM).

You can still style them, but you need to use the pseudo element [::part()](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) to pierce the encapsulation.

### Styling panels

The panels have two `::part()`

- `part="content"` which wraps your content
- `part="overflow"` which handles overflow and wraps `content`

To for example, style `content`, use `::part`

```css
.berg-panel-top {
&::part(content) {
padding: 16px;
}
}
```
7 changes: 4 additions & 3 deletions libs/react/src/lib/layout/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import '@berg-layout/core';
import {
BergLayoutInputs,
BERG_LAYOUT_DEFAULT_INPUTS,
BergLayoutInputs,
} from '@berg-layout/core';
import { PropsWithChildren } from 'react';
import { HTMLAttributes, PropsWithChildren } from 'react';

export type BergLayoutProps = PropsWithChildren<Partial<BergLayoutInputs>>;
export type BergLayoutProps = PropsWithChildren<Partial<BergLayoutInputs>> &
HTMLAttributes<HTMLDivElement>;

export const BERG_LAYOUT_DEFAULT_PROPS = BERG_LAYOUT_DEFAULT_INPUTS;

Expand Down
15 changes: 12 additions & 3 deletions libs/react/src/lib/panel/panel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import '@berg-layout/core';
import { BergPanelInputs, BERG_PANEL_DEFAULT_INPUTS } from '@berg-layout/core';
import { PropsWithChildren } from 'react';
import {
BERG_PANEL_DEFAULT_INPUTS,
BergPanelInputs,
BergPanelOutputs,
} from '@berg-layout/core';
import { HTMLAttributes, PropsWithChildren } from 'react';

export type BergPanelProps = PropsWithChildren<Partial<BergPanelInputs>>;
export type BergPanelProps = PropsWithChildren<Partial<BergPanelInputs>> &
HTMLAttributes<HTMLDivElement> & {
[P in keyof BergPanelOutputs as `on${Capitalize<string & P>}`]?: (
event: BergPanelOutputs[P]
) => void;
};

export const BERG_PANEL_DEFAULT_PROPS = BERG_PANEL_DEFAULT_INPUTS;

Expand Down
Loading

0 comments on commit d516677

Please sign in to comment.