mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-03-01 13:36:55 +08:00
feat(popconfirm): css in js (#255)
* feat(popconfirm): css in js * chore: fix code review * chore: fix code review Co-authored-by: Lecong Zhang <50313260+tskirby@users.noreply.github.com>
This commit is contained in:
parent
eaab9f5bb5
commit
8a545aafe3
@ -1,8 +0,0 @@
|
||||
/* istanbul ignore file */
|
||||
import Popconfirm from './src/Popconfirm.vue'
|
||||
|
||||
Popconfirm.install = function (Vue) {
|
||||
Vue.component(Popconfirm.name, Popconfirm)
|
||||
}
|
||||
|
||||
export default Popconfirm
|
@ -1,33 +1,33 @@
|
||||
@import './mixins/mixins.scss';
|
||||
// @import './mixins/mixins.scss';
|
||||
|
||||
@include b(popconfirm-content) {
|
||||
padding: 4px 0;
|
||||
@include m(no-icon) {
|
||||
@include e(body) {
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
@include e(body) {
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
padding-left: 22px;
|
||||
position: relative;
|
||||
@include b(icon) {
|
||||
position: absolute;
|
||||
font-size: 18px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
@include e(action) {
|
||||
margin-top: 14px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
@include b(button) {
|
||||
margin-right: 8px;
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// @include b(popconfirm-content) {
|
||||
// padding: 4px 0;
|
||||
// @include m(no-icon) {
|
||||
// @include e(body) {
|
||||
// padding-left: 0;
|
||||
// }
|
||||
// }
|
||||
// @include e(body) {
|
||||
// font-size: 13px;
|
||||
// white-space: nowrap;
|
||||
// padding-left: 22px;
|
||||
// position: relative;
|
||||
// @include b(icon) {
|
||||
// position: absolute;
|
||||
// font-size: 18px;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// }
|
||||
// }
|
||||
// @include e(action) {
|
||||
// margin-top: 14px;
|
||||
// display: flex;
|
||||
// justify-content: flex-end;
|
||||
// @include b(button) {
|
||||
// margin-right: 8px;
|
||||
// &:last-child {
|
||||
// margin-right: 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
@ -43,6 +43,8 @@ import Message from './Message'
|
||||
import Modal from './modal'
|
||||
import Notification from './Notification'
|
||||
import Pagination from './Pagination'
|
||||
import Popconfirm from './pop-confirm'
|
||||
import Popselect from './Popselect'
|
||||
import Popconfirm from './Popconfirm'
|
||||
import Popselect from './pop-select'
|
||||
import Popup from './Popover'
|
||||
@ -140,6 +142,8 @@ import loadingBarLightStyle from './loading-bar/styles/light'
|
||||
import loadingBarDarkStyle from './loading-bar/styles/dark'
|
||||
import modalDarkStyle from './modal/styles/dark'
|
||||
import modalLightStyle from './modal/styles/light'
|
||||
import popConfirmDarkStyle from './pop-confirm/styles/dark'
|
||||
import popConfirmLightStyle from './pop-confirm/styles/light'
|
||||
import popSelectLightStyle from './pop-select/styles/light'
|
||||
import popSelectDarkStyle from './pop-select/styles/dark'
|
||||
import resultDarkStyle from './result/styles/dark'
|
||||
@ -313,6 +317,8 @@ export default create({
|
||||
loadingBarLightStyle,
|
||||
modalDarkStyle,
|
||||
modalLightStyle,
|
||||
popConfirmDarkStyle,
|
||||
popConfirmLightStyle,
|
||||
popSelectLightStyle,
|
||||
popSelectDarkStyle,
|
||||
resultDarkStyle,
|
||||
|
8
src/pop-confirm/index.js
Normal file
8
src/pop-confirm/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
/* istanbul ignore file */
|
||||
import Popconfirm from './src/Popconfirm.vue'
|
||||
|
||||
Popconfirm.install = function (Vue, naive) {
|
||||
Vue.component(naive.componentPrefix + Popconfirm.name, Popconfirm)
|
||||
}
|
||||
|
||||
export default Popconfirm
|
@ -3,7 +3,7 @@ import NPopover from '../../Popover'
|
||||
import PopconfirmPanel from './PopconfirmPanel'
|
||||
|
||||
export default {
|
||||
name: 'NPopconfirm',
|
||||
name: 'Popconfirm',
|
||||
functional: true,
|
||||
props: {
|
||||
...NPopover.props,
|
@ -45,15 +45,25 @@ import NButton from '../../button'
|
||||
import NIcon from '../../icon'
|
||||
import mdAlert from '../../_icons/md-alert'
|
||||
import locale from '../../_mixins/locale'
|
||||
import withapp from '../../_mixins/withapp'
|
||||
import themeable from '../../_mixins/themeable'
|
||||
import usecssr from '../../_mixins/usecssr'
|
||||
import styles from './styles'
|
||||
|
||||
export default {
|
||||
name: 'NPopconfirmPanel',
|
||||
cssrName: 'Popconfirm',
|
||||
components: {
|
||||
NButton,
|
||||
NIcon,
|
||||
mdAlert
|
||||
},
|
||||
mixins: [ locale('Popconfirm') ],
|
||||
mixins: [
|
||||
locale('Popconfirm'),
|
||||
withapp,
|
||||
themeable,
|
||||
usecssr(styles)
|
||||
],
|
||||
props: {
|
||||
positiveText: {
|
||||
type: String,
|
9
src/pop-confirm/src/styles/index.js
Normal file
9
src/pop-confirm/src/styles/index.js
Normal file
@ -0,0 +1,9 @@
|
||||
import baseStyle from './themed-base.cssr.js'
|
||||
|
||||
export default [
|
||||
{
|
||||
key: 'syntheticTheme',
|
||||
watch: ['syntheticTheme'],
|
||||
CNode: baseStyle
|
||||
}
|
||||
]
|
57
src/pop-confirm/src/styles/themed-base.cssr.js
Normal file
57
src/pop-confirm/src/styles/themed-base.cssr.js
Normal file
@ -0,0 +1,57 @@
|
||||
import { cTB, c, cB, cE, cM } from '../../../_utils/cssr'
|
||||
|
||||
export default c([
|
||||
({ props }) => {
|
||||
return [
|
||||
cTB('popconfirm-content', {
|
||||
raw: `
|
||||
padding: 4px 0;
|
||||
`
|
||||
}, [
|
||||
cE('body', {
|
||||
raw: `
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
padding-left: 22px;
|
||||
position: relative;
|
||||
`
|
||||
}, [
|
||||
cB('icon', {
|
||||
raw: `
|
||||
position: absolute;
|
||||
font-size: 18px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
`
|
||||
})
|
||||
]),
|
||||
cM('no-icon', [
|
||||
cE('body', {
|
||||
raw: `
|
||||
padding-left: 0;
|
||||
`
|
||||
})
|
||||
]),
|
||||
cE('action', {
|
||||
raw: `
|
||||
margin-top: 14px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
`
|
||||
}, [
|
||||
cB('button', {
|
||||
raw: `
|
||||
margin-right: 8px;
|
||||
`
|
||||
}, [
|
||||
c('&:last-child', {
|
||||
raw: `
|
||||
margin-right: 0;
|
||||
`
|
||||
})
|
||||
])
|
||||
])
|
||||
])
|
||||
]
|
||||
}
|
||||
])
|
11
src/pop-confirm/styles/dark.js
Normal file
11
src/pop-confirm/styles/dark.js
Normal file
@ -0,0 +1,11 @@
|
||||
import create from '../../styles/_utils/create-component-base'
|
||||
|
||||
export default create({
|
||||
name: 'Popconfirm',
|
||||
theme: 'dark',
|
||||
getDerivedVariables ({ base, derived }) {
|
||||
return {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
11
src/pop-confirm/styles/light.js
Normal file
11
src/pop-confirm/styles/light.js
Normal file
@ -0,0 +1,11 @@
|
||||
import create from '../../styles/_utils/create-component-base'
|
||||
|
||||
export default create({
|
||||
name: 'Popconfirm',
|
||||
theme: 'light',
|
||||
getDerivedVariables ({ base, derived }) {
|
||||
return {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue
Block a user