Skip to content

Commit

Permalink
release(notification): v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Jan 7, 2024
1 parent 92c05db commit 1cc5d30
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 19 deletions.
4 changes: 2 additions & 2 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
"dependencies": []
},
"notification": {
"version": "0.1.6",
"version": "0.2.0",
"style": true,
"icon": false,
"test": true,
Expand All @@ -234,9 +234,9 @@
"dependencies": []
},
"painter": {
"icon": true,
"version": "0.1.0",
"style": true,
"icon": false,
"test": true,
"install": false,
"react": false,
Expand Down
1 change: 1 addition & 0 deletions src/notification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ notification.dismissAll()
## Configuration

* duration(number): Default duration, 0 means infinite.
* inline(boolean): Enable inline mode.
* position(IPosition): Notification position.

## Api
Expand Down
7 changes: 7 additions & 0 deletions src/notification/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface IOptions extends IComponentOptions {
position?: IPosition
/** Default duration, 0 means infinite. */
duration?: number
/** Enable inline mode. */
inline?: boolean
}

/**
Expand Down Expand Up @@ -53,9 +55,14 @@ export default class Notification extends Component<IOptions> {
x: 'right',
y: 'bottom',
},
inline: false,
duration: 2000,
})

if (!this.options.inline) {
this.$container.addClass(this.c('full'))
}

this.initTpl()
}
/** Show notification. */
Expand Down
2 changes: 1 addition & 1 deletion src/notification/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "notification",
"version": "0.1.6",
"version": "0.2.0",
"description": "Show notifications"
}
15 changes: 14 additions & 1 deletion src/notification/story.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
import 'luna-notification.css'
import Notification from 'luna-notification.js'
import readme from './README.md'
import { select, text, number, button } from '@storybook/addon-knobs'
import { select, text, number, button, boolean } from '@storybook/addon-knobs'
import story from '../share/story'
import $ from 'licia/$'

const def = story(
'notification',
(container) => {
const x = select('X', ['left', 'center', 'right'], 'center')
const y = select('Y', ['top', 'bottom'], 'top')

const inline = boolean('Inline Mode', false)

const notification = new Notification(container, {
position: {
x,
y,
},
inline,
})

if (inline) {
$(container).css({
width: '100%',
maxWidth: 640,
height: 360,
border: '1px solid #eee',
})
}

const content = text('Content', 'Luna Notification')
const duration = number('Duration', 5000, {
range: true,
Expand Down
33 changes: 19 additions & 14 deletions src/notification/style.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
@import '../share/variable';
@import '../share/mixin';
@import '../share/theme';

.luna-notification {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
@include component();
position: relative;
padding: 20px;
box-sizing: border-box;
pointer-events: none;
display: flex;
flex-direction: column;
font-size: 14px;
font-family: $font-family;
overflow: hidden;
background: transparent;
&.full {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}

.item {
display: flex;
box-shadow: $box-shadow;
border: 1px solid $color-border;
padding: 10px 16px;
color: $foreground-color;
background: $background-color;
color: $color-text;
background: $color-bg-container;
}

.lower {
Expand All @@ -33,8 +37,9 @@

.theme-dark {
.item {
border-color: $color-border-dark;
box-shadow: $box-shadow-dark;
color: $foreground-color-dark;
background: $background-color-dark;
color: $color-text-dark;
background: $color-bg-container-dark;
}
}
2 changes: 1 addition & 1 deletion src/share/mixin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
font-family: $font-family;
box-sizing: border-box;
user-select: none;
font-size: $font-size;
font-size: #{$font-size}px;
&.platform-windows {
font-family: 'Segoe UI', Tahoma, sans-serif;
}
Expand Down

0 comments on commit 1cc5d30

Please sign in to comment.