Skip to content

Commit 55736df

Browse files
committed
Fix CSS modules implementation based on review feedback
- Restore CSS files with proper .module.css naming convention - Fix CSS imports to use 'import * as style from' syntax - Update className usage to use CSS modules (style.bright) - Address reviewer feedback about not completely removing CSS files - Use proper CSS modules pattern instead of regular CSS imports
1 parent f55e56c commit 55736df

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React, { useState } from 'react';
3+
import * as style from './HelloWorld.module.css';
34

45
const HelloWorld = (props) => {
56
const [name, setName] = useState(props.name);
@@ -9,7 +10,7 @@ const HelloWorld = (props) => {
910
<h3>Hello, {name}!</h3>
1011
<hr />
1112
<form>
12-
<label className="bright" htmlFor="name">
13+
<label className={style.bright} htmlFor="name">
1314
Say hello to:
1415
<input id="name" type="text" value={name} onChange={(e) => setName(e.target.value)} />
1516
</label>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.bright {
2+
color: green;
3+
font-weight: bold;
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.bright {
2+
color: green;
3+
font-weight: bold;
4+
}

lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React, { useState } from 'react';
3+
import * as style from '../HelloWorld.module.css';
34

45
const HelloWorld = (props) => {
56
const [name, setName] = useState(props.name);
@@ -9,7 +10,7 @@ const HelloWorld = (props) => {
910
<h3>Hello, {name}!</h3>
1011
<hr />
1112
<form>
12-
<label className="bright" htmlFor="name">
13+
<label className={style.bright} htmlFor="name">
1314
Say hello to:
1415
<input id="name" type="text" value={name} onChange={(e) => setName(e.target.value)} />
1516
</label>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.bright {
2+
color: green;
3+
font-weight: bold;
4+
}

0 commit comments

Comments
 (0)