Skip to content

Part of code gets changed #2

@pionl

Description

@pionl

Hi, for my usecase not all the class names are resolved. I have mainly 2 problems:

1. The classnames with a function wont be prefixed

I need to call the getClassName function that will build the final classname. This part wont be prefixed. The result is: prefix-glog-item item-video

    /**
     * Returns the items class name
     * @return {string}
     */
    getClassName () {
        return `item-${this.props.item.type}`
    }

    /**
     * Returns the container props
     * @return {object}
     */
    getItemContainerProps () {
        // Build the glog item class
        const className = classnames('glog-item', this.getClassName())
        console.log(className)
        return {
            className: className,
            styleLogic: this.state.styleLogic
        }
    }

2. Part of the code gets replaced

I'm building class name with a typeof check (needs to be function). The function string is replaced. The result will be only prefix-glog-item-container. With this kind of problem I don't know if all code will be working correctly.

// Get the onClick function if provided, don't enable on click when
        // the item is loading
        const onClick = loading ? null : interaction.getOnClickListener()

        // Build the container class name. Pass class when item can be clicked
        const containerClassName = classnames('glog-item-container', {
            'item-click-able': typeof onClick === 'function'
        })

        console.log(onClick, typeof onClick === 'function')

This is the final code, as you can see, the function string is prefixed-

var containerClassName = (0, _classnames2.default)('glrv-glog-item-container', {
               'glrv-item-click-able': typeof onClick === 'glrv-function'
           });

console.log(onClick, typeof onClick === 'glrv-function');

Any ideas/suggestions?

Thank you,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions