Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
68659562
Commit
68659562
authored
Apr 19, 2019
by
Zhi Cun
Committed by
hetech
Apr 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alert: Add dark theme (#15041)
parent
128feba1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
216 additions
and
25 deletions
+216
-25
examples/docs/en-US/alert.md
examples/docs/en-US/alert.md
+38
-6
examples/docs/es/alert.md
examples/docs/es/alert.md
+33
-1
examples/docs/fr-FR/alert.md
examples/docs/fr-FR/alert.md
+33
-1
examples/docs/zh-CN/alert.md
examples/docs/zh-CN/alert.md
+34
-0
packages/alert/src/main.vue
packages/alert/src/main.vue
+9
-2
packages/theme-chalk/src/alert.scss
packages/theme-chalk/src/alert.scss
+57
-15
test/unit/specs/alert.spec.js
test/unit/specs/alert.spec.js
+8
-0
types/alert.d.ts
types/alert.d.ts
+4
-0
No files found.
examples/docs/en-US/alert.md
View file @
68659562
...
@@ -30,6 +30,37 @@ Alert components are non-overlay elements in the page that does not disappear au
...
@@ -30,6 +30,37 @@ Alert components are non-overlay elements in the page that does not disappear au
```
```
:::
:::
### Theme
Alert provide two different themes,
`light`
and
`dark`
.
:::demo Set
`effect`
to change theme, default is
`light`
.
```
html
<template>
<el-alert
title=
"success alert"
type=
"success"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"info alert"
type=
"info"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"warning alert"
type=
"warning"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"error alert"
type=
"error"
effect=
"dark"
>
</el-alert>
</template>
```
:::
### Customizable close button
### Customizable close button
Customize the close button as texts or other symbols.
Customize the close button as texts or other symbols.
...
@@ -190,12 +221,13 @@ Description includes a message with more detailed information.
...
@@ -190,12 +221,13 @@ Description includes a message with more detailed information.
| Attribute | Description | Type | Accepted Values | Default |
| Attribute | Description | Type | Accepted Values | Default |
|---------- |-------------- |---------- |-------------------------------- |-------- |
|---------- |-------------- |---------- |-------------------------------- |-------- |
| title | title | string | — | — |
| title | title | string | — | — |
| type | component type | string | success/warning/info/error | info |
| type | Component type | string | success/warning/info/error | info |
| description | descriptive text. Can also be passed with the default slot | string | — | — |
| description | Descriptive text. Can also be passed with the default slot | string | — | — |
| closable | if closable or not | boolean | — | true |
| closable | If closable or not | boolean | — | true |
| center | whether to center the text | boolean | — | false |
| center | Whether to center the text | boolean | — | false |
| close-text | customized close button text | string | — | — |
| close-text | Customized close button text | string | — | — |
| show-icon | if a type icon is displayed | boolean | — | false |
| show-icon | If a type icon is displayed | boolean | — | false |
| effect | Choose theme | string | light/dark | light |
### Slot
### Slot
...
...
examples/docs/es/alert.md
View file @
68659562
...
@@ -30,7 +30,38 @@ Los componentes de alertas no son elementos overlay de la página y no desaparec
...
@@ -30,7 +30,38 @@ Los componentes de alertas no son elementos overlay de la página y no desaparec
```
```
:::
:::
### Personalización del botón de cerrar
### Theme
Alert provide two different themes,
`light`
and
`dark`
.
:::demo Set
`effect`
to change theme, default is
`light`
.
```
html
<template>
<el-alert
title=
"success alert"
type=
"success"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"info alert"
type=
"info"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"warning alert"
type=
"warning"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"error alert"
type=
"error"
effect=
"dark"
>
</el-alert>
</template>
```
:::
### Personalización del botón de cerrar
Personalizar el botón de cerrar como texto u otros símbolos.
Personalizar el botón de cerrar como texto u otros símbolos.
...
@@ -198,6 +229,7 @@ Descripción incluye un mensaje con información más detallada.
...
@@ -198,6 +229,7 @@ Descripción incluye un mensaje con información más detallada.
| center | si el texto debe estar centrado | boolean | — | false |
| center | si el texto debe estar centrado | boolean | — | false |
| close-text | texto de cerrado personalizado | string | — | — |
| close-text | texto de cerrado personalizado | string | — | — |
| show-icon | si un icono del tipo de alerta se debe mostrar | boolean | — | false |
| show-icon | si un icono del tipo de alerta se debe mostrar | boolean | — | false |
| effect | Choose theme | string | light/dark | light |
### Slot
### Slot
...
...
examples/docs/fr-FR/alert.md
View file @
68659562
## Alert
e
## Alert
Affiche des messages importants.
Affiche des messages importants.
...
@@ -30,6 +30,37 @@ Les Alertes sont des composants non-superposés qui ne disparaissent pas automat
...
@@ -30,6 +30,37 @@ Les Alertes sont des composants non-superposés qui ne disparaissent pas automat
```
```
:::
:::
### Theme
Alert provide two different themes,
`light`
and
`dark`
.
:::demo Set
`effect`
to change theme, default is
`light`
.
```
html
<template>
<el-alert
title=
"success alert"
type=
"success"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"info alert"
type=
"info"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"warning alert"
type=
"warning"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"error alert"
type=
"error"
effect=
"dark"
>
</el-alert>
</template>
```
:::
### Bouton personnalisable
### Bouton personnalisable
Personnalisez le bouton de fermeture avec du texte ou des symboles.
Personnalisez le bouton de fermeture avec du texte ou des symboles.
...
@@ -196,6 +227,7 @@ Contient un message avec plus d'informations.
...
@@ -196,6 +227,7 @@ Contient un message avec plus d'informations.
| center | Si le texte doit être centré ou non. | boolean | — | false |
| center | Si le texte doit être centré ou non. | boolean | — | false |
| close-text | Texte personnalisé pour le bouton de fermeture. | string | — | — |
| close-text | Texte personnalisé pour le bouton de fermeture. | string | — | — |
| show-icon | Si une icône s'affiche ou non. | boolean | — | false |
| show-icon | Si une icône s'affiche ou non. | boolean | — | false |
| effect | Choose theme | string | light/dark | light |
### Slot
### Slot
...
...
examples/docs/zh-CN/alert.md
View file @
68659562
...
@@ -29,6 +29,39 @@
...
@@ -29,6 +29,39 @@
```
```
:::
:::
### 主题
Alert 组件提供了两个不同的主题:
`light`
和
`dark`
。
:::demo 通过设置
`effect`
属性来改变主题,默认为
`light`
。
```
html
<template>
<el-alert
title=
"成功提示的文案"
type=
"success"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"消息提示的文案"
type=
"info"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"警告提示的文案"
type=
"warning"
effect=
"dark"
>
</el-alert>
<el-alert
title=
"错误提示的文案"
type=
"error"
effect=
"dark"
>
</el-alert>
</template>
```
:::
### 自定义关闭按钮
### 自定义关闭按钮
自定义关闭按钮为文字或其他符号。
自定义关闭按钮为文字或其他符号。
...
@@ -190,6 +223,7 @@
...
@@ -190,6 +223,7 @@
| center | 文字是否居中 | boolean | — | true |
| center | 文字是否居中 | boolean | — | true |
| close-text | 关闭按钮自定义文本 | string | — | — |
| close-text | 关闭按钮自定义文本 | string | — | — |
| show-icon | 是否显示图标 | boolean | — | false |
| show-icon | 是否显示图标 | boolean | — | false |
| effect | 选择提供的主题 | string | light/dark | light |
### Slot
### Slot
...
...
packages/alert/src/main.vue
View file @
68659562
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<transition
name=
"el-alert-fade"
>
<transition
name=
"el-alert-fade"
>
<div
<div
class=
"el-alert"
class=
"el-alert"
:class=
"[typeClass, center ? 'is-center' : '']"
:class=
"[typeClass, center ? 'is-center' : ''
, 'is-' + effect
]"
v-show=
"visible"
v-show=
"visible"
role=
"alert"
role=
"alert"
>
>
...
@@ -50,7 +50,14 @@
...
@@ -50,7 +50,14 @@
default
:
''
default
:
''
},
},
showIcon
:
Boolean
,
showIcon
:
Boolean
,
center
:
Boolean
center
:
Boolean
,
effect
:
{
type
:
String
,
default
:
'
light
'
,
validator
:
function
(
value
)
{
return
[
'
light
'
,
'
dark
'
].
indexOf
(
value
)
!==
-
1
;
}
}
},
},
data
()
{
data
()
{
...
...
packages/theme-chalk/src/alert.scss
View file @
68659562
...
@@ -15,22 +15,51 @@
...
@@ -15,22 +15,51 @@
align-items
:
center
;
align-items
:
center
;
transition
:
opacity
.2s
;
transition
:
opacity
.2s
;
@include
when
(
light
)
{
.el-alert__closebtn
{
color
:
$--color-text-placeholder
;
}
}
@include
when
(
dark
)
{
.el-alert__closebtn
{
color
:
$--color-white
;
}
.el-alert__description
{
color
:
$--color-white
;
}
}
@include
when
(
center
)
{
@include
when
(
center
)
{
justify-content
:
center
;
justify-content
:
center
;
}
}
@include
m
(
success
)
{
@include
m
(
success
)
{
background-color
:
$--alert-success-color
;
&
.is-light
{
color
:
$--color-success
;
background-color
:
$--alert-success-color
;
.el-alert__description
{
color
:
$--color-success
;
color
:
$--color-success
;
.el-alert__description
{
color
:
$--color-success
;
}
}
&
.is-dark
{
background-color
:
$--color-success
;
color
:
$--color-white
;
}
}
}
}
@include
m
(
info
)
{
@include
m
(
info
)
{
background-color
:
$--alert-info-color
;
&
.is-light
{
color
:
$--color-info
;
background-color
:
$--alert-info-color
;
color
:
$--color-info
;
}
&
.is-dark
{
background-color
:
$--color-info
;
color
:
$--color-white
;
}
.el-alert__description
{
.el-alert__description
{
color
:
$--color-info
;
color
:
$--color-info
;
...
@@ -38,20 +67,34 @@
...
@@ -38,20 +67,34 @@
}
}
@include
m
(
warning
)
{
@include
m
(
warning
)
{
background-color
:
$--alert-warning-color
;
&
.is-light
{
color
:
$--color-warning
;
background-color
:
$--alert-warning-color
;
.el-alert__description
{
color
:
$--color-warning
;
color
:
$--color-warning
;
.el-alert__description
{
color
:
$--color-warning
;
}
}
&
.is-dark
{
background-color
:
$--color-warning
;
color
:
$--color-white
;
}
}
}
}
@include
m
(
error
)
{
@include
m
(
error
)
{
background-color
:
$--alert-danger-color
;
&
.is-light
{
color
:
$--color-danger
;
background-color
:
$--alert-danger-color
;
.el-alert__description
{
color
:
$--color-danger
;
color
:
$--color-danger
;
.el-alert__description
{
color
:
$--color-danger
;
}
}
&
.is-dark
{
background-color
:
$--color-danger
;
color
:
$--color-white
;
}
}
}
}
...
@@ -84,7 +127,6 @@
...
@@ -84,7 +127,6 @@
@include
e
(
closebtn
)
{
@include
e
(
closebtn
)
{
font-size
:
$--alert-close-font-size
;
font-size
:
$--alert-close-font-size
;
color
:
$--color-text-placeholder
;
opacity
:
1
;
opacity
:
1
;
position
:
absolute
;
position
:
absolute
;
top
:
12px
;
top
:
12px
;
...
...
test/unit/specs/alert.spec.js
View file @
68659562
...
@@ -35,6 +35,14 @@ describe('Alert', () => {
...
@@ -35,6 +35,14 @@ describe('Alert', () => {
.
to
.
equal
(
'
Unbowed, Unbent, Unbroken
'
);
.
to
.
equal
(
'
Unbowed, Unbent, Unbroken
'
);
});
});
it
(
'
theme
'
,
()
=>
{
vm
=
createTest
(
Alert
,
{
title
:
'
test
'
,
effect
:
'
dark
'
},
true
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
is-dark
'
)).
to
.
true
;
});
it
(
'
title slot
'
,
()
=>
{
it
(
'
title slot
'
,
()
=>
{
vm
=
createVue
(
`
vm
=
createVue
(
`
<el-alert>
<el-alert>
...
...
types/alert.d.ts
View file @
68659562
import
{
ElementUIComponent
}
from
'
./component
'
import
{
ElementUIComponent
}
from
'
./component
'
export
type
AlertType
=
'
success
'
|
'
warning
'
|
'
info
'
|
'
error
'
export
type
AlertType
=
'
success
'
|
'
warning
'
|
'
info
'
|
'
error
'
export
type
AlertEffect
=
'
dark
'
|
'
light
'
/** Alert Component */
/** Alert Component */
export
declare
class
ElAlert
extends
ElementUIComponent
{
export
declare
class
ElAlert
extends
ElementUIComponent
{
...
@@ -24,4 +25,7 @@ export declare class ElAlert extends ElementUIComponent {
...
@@ -24,4 +25,7 @@ export declare class ElAlert extends ElementUIComponent {
/** If a type icon is displayed */
/** If a type icon is displayed */
showIcon
:
boolean
showIcon
:
boolean
/** Choose theme */
theme
:
AlertEffect
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment