Skip to content

Commit

Permalink
fix failed effect style
Browse files Browse the repository at this point in the history
  • Loading branch information
leadream committed Oct 23, 2020
1 parent 24b2bfd commit ff3b52a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/components/icons/style.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/page/right/items/StyleItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default ({styles, styleName, styleType, isHoverable=true, ...props}) => {
</a>
case 'EFFECT':
const { type } = getEffectsStyle(styles)
console.log('type', type)
return <a className={cn('style-item style-item-effect', {'style-item-hoverable': isHoverable})} {...props}>
<div className="item-preview">
{ EFFECTS[type].icon }
Expand Down
5 changes: 4 additions & 1 deletion src/utils/const.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { DropShadow, InnerShadow, LayerBlur, BackgroundBlur, MixEffect } from 'components/icons/style'
import { DropShadow, InnerShadow, LayerBlur, BackgroundBlur, MixEffect, FailedEffect } from 'components/icons/style'
import {
SmallThin, NormalThin, LargeThin,
SmallRegular, NormalRegular, LargeRegular,
Expand Down Expand Up @@ -30,6 +30,9 @@ export const EFFECTS = {
},
'MIX_EFFECT': {
icon: <MixEffect size={18} className="effect-thumbnail"/>
},
'FAILED_EFFECT': {
icon: <FailedEffect size={18} className="effect-thumbnail"/>
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ export const getShadowEffect = effect => ({
})

export const getEffectsStyle = effects => {
if (!effects) {
return { styles:[] }
if (!effects || effects.length===0) {
return { type: 'FAILED_EFFECT', styles:[] }
}
let type = ''
const styles = effects
Expand Down

0 comments on commit ff3b52a

Please sign in to comment.