Skip to content

What is the correct way import the CSS? #27

@sean256

Description

@sean256

I have a component which I want to use dragula on:

import React, { Component } from 'react';
import styles from './SomeComponent.scss';
import Dragula from 'react-dragula';

class SomeComponent extends Component{
	render(){
		let {children} = this.props
		return(
			<div className={styles['someClass']}>
				<div ref={this.dragulaDecorator}>
					{children}
				</div>
			</div>
		)
	}

	dragulaDecorator = (componentBackingInstance) => {
		if (componentBackingInstance) {
			let options = { };
			Dragula([componentBackingInstance], options);
		}
	};
}

When I try and use it, nothing appears to happen. When looking in Chromes Elements Inspector I can see it's creating the 'mirror' element and doing its thing, but the styles for the classes it's attaching to these elements are not loaded.

In the standard dragula docs it states that the styles must be imported, @import 'node_modules/dragula/dragula'

However, are these not supposed to auto load here when including the Dragula component? And if not what is the best way to get this in?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions