| 31 | } |
| 32 | |
| 33 | const buildStyledProps = (propsNames: string[], childComponent: IComponent) => { |
| 34 | let propsContent = `` |
| 35 | |
| 36 | propsNames.forEach((propName: string) => { |
| 37 | const propsValue = childComponent.props[propName] |
| 38 | |
| 39 | if ( |
| 40 | propName.toLowerCase().includes('icon') && |
| 41 | childComponent.type !== 'Icon' |
| 42 | ) { |
| 43 | if (Object.keys(icons).includes(propsValue)) { |
| 44 | let operand = `={<${propsValue} />}` |
| 45 | |
| 46 | propsContent += `${propName}${operand} ` |
| 47 | } |
| 48 | } else if (propName !== 'children' && propsValue) { |
| 49 | let operand = `='${propsValue}'` |
| 50 | |
| 51 | if (propsValue === true || propsValue === 'true') { |
| 52 | operand = `` |
| 53 | } else if ( |
| 54 | propsValue === 'false' || |
| 55 | isBoolean(propsValue) || |
| 56 | !isNaN(propsValue) |
| 57 | ) { |
| 58 | operand = `={${propsValue}}` |
| 59 | } |
| 60 | |
| 61 | propsContent += `${propName}${operand} ` |
| 62 | } |
| 63 | }) |
| 64 | |
| 65 | return propsContent |
| 66 | } |
| 67 | |
| 68 | const buildBlock = ({ |
| 69 | component, |