Skip to content

Commit

Permalink
feat(ld-notice): add text notice component
Browse files Browse the repository at this point in the history
  • Loading branch information
renet authored and borisdiakur committed Jan 28, 2022
1 parent 7e82ba6 commit b10ca2a
Show file tree
Hide file tree
Showing 18 changed files with 659 additions and 9 deletions.
156 changes: 156 additions & 0 deletions screenshot/builds/master.json
Original file line number Diff line number Diff line change
Expand Up @@ -6062,6 +6062,162 @@
"isLandscape": false,
"isMobile": false
},
{
"id": "ad43b06f",
"image": "b728c4848c1c23bbd81f8c6190c101f3.png",
"userAgent": "default",
"desc": "ld-notice css component with headline error",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "2fb2ba54",
"image": "5fe7d12c13877d80552f75d8ddd72591.png",
"userAgent": "default",
"desc": "ld-notice css component with headline info",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "58285396",
"image": "dfeef23478f8e4194218302b7c8405da.png",
"userAgent": "default",
"desc": "ld-notice css component with headline warning",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "eba9d27f",
"image": "763136d88f532b45b203aaea6c0cdd76.png",
"userAgent": "default",
"desc": "ld-notice css component without headline error",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "3abbecbf",
"image": "3c01307fe790737af4e62da4ad19ef22.png",
"userAgent": "default",
"desc": "ld-notice css component without headline info",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "3c944857",
"image": "a570d2d006ae22e68ac19196e3430471.png",
"userAgent": "default",
"desc": "ld-notice css component without headline warning",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "d21736c2",
"image": "b728c4848c1c23bbd81f8c6190c101f3.png",
"userAgent": "default",
"desc": "ld-notice web component with headline error",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "795d4a70",
"image": "5fe7d12c13877d80552f75d8ddd72591.png",
"userAgent": "default",
"desc": "ld-notice web component with headline info",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "48dd46c1",
"image": "dfeef23478f8e4194218302b7c8405da.png",
"userAgent": "default",
"desc": "ld-notice web component with headline warning",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "449daf7a",
"image": "763136d88f532b45b203aaea6c0cdd76.png",
"userAgent": "default",
"desc": "ld-notice web component without headline error",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "05f32254",
"image": "3c01307fe790737af4e62da4ad19ef22.png",
"userAgent": "default",
"desc": "ld-notice web component without headline info",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "4a2ee30f",
"image": "a570d2d006ae22e68ac19196e3430471.png",
"userAgent": "default",
"desc": "ld-notice web component without headline warning",
"testPath": "./src/liquid/components/ld-notice/test/ld-notice.e2e.ts",
"width": 600,
"height": 600,
"deviceScaleFactor": 1,
"hasTouch": false,
"isLandscape": false,
"isMobile": false
},
{
"id": "2d63ca44",
"image": "c7d9faac3dcba3dc509e3816bad06f44.png",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/liquid/components/ld-icon/ld-icon.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:host,
:where(.ld-icon) {
--ld-icon-secondary-col: var(--ld-col-wht);
--ld-icon-size-sm: 1rem;
--ld-icon-size-md: 1.25rem;
--ld-icon-size-lg: 1.5rem;
Expand Down
2 changes: 2 additions & 0 deletions src/liquid/components/ld-icon/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,15 @@ Left-click an icon below to download its SVG file. To download all icons at once

- [ld-header](../ld-header)
- [ld-input-message](../ld-input-message)
- [ld-notice](../ld-notice)
- [ld-pagination](../ld-pagination)

### Graph
```mermaid
graph TD;
ld-header --> ld-icon
ld-input-message --> ld-icon
ld-notice --> ld-icon
ld-pagination --> ld-icon
style ld-icon fill:#f9f,stroke:#333,stroke-width:4px
```
Expand Down
6 changes: 3 additions & 3 deletions src/liquid/components/ld-input-message/assets/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 16 additions & 6 deletions src/liquid/components/ld-input-message/ld-input-message.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
:host,
.ld-input-message {
--ld-input-message-valid-text-col: var(--ld-thm-success);
--ld-input-message-error-text-col: var(--ld-thm-error);
--ld-input-message-info-text-col: var(--ld-thm-warning);
--ld-input-message-valid-text-col: var(--ld-thm-success);

display: inline-flex;
align-items: baseline;
font: var(--ld-typo-body-s);
line-height: 1.5;
}

:host(.ld-input-message--valid),
.ld-input-message--valid {
color: var(--ld-input-message-valid-text-col);
}

:host(.ld-input-message--error),
.ld-input-message--error {
color: var(--ld-input-message-error-text-col);
}

:host(.ld-input-message--info),
.ld-input-message--info {
color: var(--ld-input-message-info-text-col);

.ld-input-message__icon {
--ld-icon-secondary-col: var(--ld-col-neutral-900);
}
}

:host(.ld-input-message--valid),
.ld-input-message--valid {
color: var(--ld-input-message-valid-text-col);
}

.ld-input-message__icon {
transform: translateY(var(--ld-sp-2));
margin-top: var(--ld-sp-2);
Expand Down
66 changes: 66 additions & 0 deletions src/liquid/components/ld-notice/ld-notice.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
:host,
.ld-notice {
--ld-notice-error-text-col: var(--ld-thm-error);
--ld-notice-info-text-col: var(--ld-thm-primary);
--ld-notice-warning-text-col: var(--ld-thm-warning);

align-items: baseline;
border-radius: var(--ld-br-l);
box-shadow: var(--ld-shadow-stacked);
color: var(--ld-col-neutral-800);
display: flex;
flex-direction: column;
font: var(--ld-typo-body-s);
padding: var(--ld-sp-24);
padding-left: calc(var(--ld-sp-24) + var(--ld-sp-40));
position: relative;
}

:host(.ld-notice--error),
.ld-notice--error {
background: var(--ld-thm-error-highlight);

.ld-notice__icon,
.ld-notice__headline {
color: var(--ld-notice-error-text-col);
}

.ld-notice__icon {
transform: rotate(180deg);
}
}

:host(.ld-notice--info),
.ld-notice--info {
.ld-notice__icon {
color: var(--ld-notice-info-text-col);
}

.ld-notice__headline {
color: var(--ld-notice-info-text-col);
}
}

:host(.ld-notice--warning),
.ld-notice--warning {
background: var(--ld-thm-warning-highlight);

.ld-notice__icon {
color: var(--ld-notice-warning-text-col);
--ld-icon-secondary-col: var(--ld-col-neutral-900);
}

.ld-notice__headline {
color: var(--ld-col-neutral-900);
}
}

.ld-notice__headline {
margin: 0 0 var(--ld-sp-12);
}

.ld-notice__icon {
left: var(--ld-sp-24);
position: absolute;
top: var(--ld-sp-24);
}
36 changes: 36 additions & 0 deletions src/liquid/components/ld-notice/ld-notice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import '../../components' // type definitions for type checks and intelliSense
import { Component, h, Prop, Host } from '@stencil/core'

/**
* @virtualProp ref - reference to component
* @virtualProp {string | number} key - for tracking the node's identity when working with lists
* @part headline - `ld-typo` element used for the headline
* @part icon - Image tag used for the icon
*/
@Component({
tag: 'ld-notice',
styleUrl: 'ld-notice.css',
shadow: true,
})
export class LdNotice {
/** Mode of the notice. */
@Prop() headline?: string

/** Mode of the notice. */
@Prop() mode: 'error' | 'info' | 'warning' = 'info'

render() {
return (
<Host class={`ld-notice ld-notice--${this.mode}`}>
<ld-icon
class="ld-notice__icon"
name="info"
part="icon"
size="lg"
/>
{this.headline && <ld-typo class="ld-notice__headline" variant="h4" tag="p" part="headline">{this.headline}</ld-typo>}
<slot></slot>
</Host>
)
}
}
Loading

0 comments on commit b10ca2a

Please sign in to comment.