forked from cybrespace/pinafore
faster classname function
This commit is contained in:
parent
2db30856f9
commit
1477fbfbda
|
@ -60,16 +60,19 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
|
||||
import { classname } from '../_utils/classname'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
computedClass: (pressable, pressed, big, className) => {
|
||||
return [
|
||||
return classname(
|
||||
'icon-button',
|
||||
!pressable && 'not-pressable',
|
||||
pressed && 'pressed',
|
||||
big && 'big-icon',
|
||||
className
|
||||
].filter(Boolean).join(' ')
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
import { store } from '../../_store/store'
|
||||
import { goto } from 'sapper/runtime.js'
|
||||
import { registerClickDelegate, unregisterClickDelegate } from '../../_utils/delegate'
|
||||
import { classname } from '../../_utils/classname'
|
||||
|
||||
export default {
|
||||
oncreate() {
|
||||
|
@ -124,11 +125,11 @@
|
|||
store: () => store,
|
||||
helpers: {
|
||||
getClasses(originalStatus, timelineType, isStatusInOwnThread) {
|
||||
return [
|
||||
return classname(
|
||||
originalStatus.visibility === 'direct' && 'status-direct',
|
||||
timelineType !== 'search' && 'status-in-timeline',
|
||||
isStatusInOwnThread && 'status-in-own-thread'
|
||||
].filter(Boolean).join(' ')
|
||||
)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
export function classname () {
|
||||
let res = ''
|
||||
let len = arguments.length
|
||||
let i = -1
|
||||
while (++i < len) {
|
||||
let item = arguments[i]
|
||||
if (item) {
|
||||
if (res) {
|
||||
res += ' '
|
||||
}
|
||||
res += item
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
Loading…
Reference in New Issue