Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put my .scsc file with my component #7

Open
youbihi opened this issue Dec 8, 2018 · 1 comment
Open

Put my .scsc file with my component #7

youbihi opened this issue Dec 8, 2018 · 1 comment

Comments

@youbihi
Copy link

youbihi commented Dec 8, 2018

Hello,

I am trying to use keystone4-universal-react for a personal project. I am of course a junior dev trying to learn: reactjs, nodejs and KeystoneJS 4.

I would like to structure my project to be able to have a component that has its .scss file in the same folder like this:

`import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from './star.scss';

const Star = ({ selected = false, onClick = f => f }) =>
< div className={(selected) ? styles.star.selected : styles.star }
onClick={onClick} >
</ div >

Star.propTypes = {
selected: PropTypes.bool,
onClick: PropTypes.func
}

export default Star;`

my .scss file would look like this:

`
.star {
cursor: pointer;
height: 25px;
width: 25px;
margin: 2px;
float: left;
background-color: grey;
clip-path: polygon(
50% 0%,
63% 38%,
100% 38%,
69% 59%,
82% 100%,
50% 75%,
18% 100%,
31% 59%,
0% 38%,
37% 38%
);
}

.star.selected { background-color: red; }`

what do I need to change in the code so that it works ? webpack.config.js ?

for now I have a error:
`Unexpected token (2:0)
1 |

2 | .star {
| ^
3 | cursor: pointer;
4 | height: 25px;
5 | width: 25px;`

Can you please help ?

@youbihi
Copy link
Author

youbihi commented Dec 14, 2018

Is there someone to help me please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant