Skip to content

Commit c436db5

Browse files
committed
ADDED: Support for styling the DOM elements via CSS classes. Version bumped to 1.2.0.
1 parent 48d4364 commit c436db5

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to this project is documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [1.2.0]
7+
8+
- ADDED: Support for styling the DOM elements via CSS classes.
9+
610
## [1.1.0]
711

812
- ADDED: Displaying humidity data if provided by the sensor.

MMM-RemoteTemperature.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
margin-right: 15px;
33
}
44

5+
.MMM-RemoteTemperature .temp {
6+
margin: 0;
7+
}
8+
59
.MMM-RemoteTemperature .humidity {
610
display: inline-block;
711
margin-left: 10px;
812
}
913

14+
.MMM-RemoteTemperature .time {
15+
margin: 0;
16+
}

MMM-RemoteTemperature.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Module.register('MMM-RemoteTemperature', {
2424
return [
2525
'MMM-RemoteTemperature.css',
2626
'font-awesome.css',
27-
'font-awesome5.css',
27+
'font-awesome5.css'
2828
];
2929
},
3030

@@ -53,12 +53,13 @@ Module.register('MMM-RemoteTemperature', {
5353
}
5454

5555
const tempEl = document.createElement('span');
56+
tempEl.classList = 'temp';
5657
tempEl.innerHTML = `${this.viewModel.temp}°`;
5758
firstLineEl.appendChild(tempEl);
5859

5960
if (this.viewModel.humidity) {
6061
const humidityEl = document.createElement('span');
61-
humidityEl.classList = "humidity";
62+
humidityEl.classList = 'humidity';
6263
humidityEl.innerHTML = `${this.viewModel.humidity}%`;
6364
firstLineEl.appendChild(humidityEl);
6465
}
@@ -67,7 +68,7 @@ Module.register('MMM-RemoteTemperature', {
6768

6869
if (this.config.showTime) {
6970
const secondLineEl = document.createElement('div');
70-
secondLineEl.classList = 'dimmed small';
71+
secondLineEl.classList = 'time dimmed small';
7172
secondLineEl.innerHTML = `(${this._formatTimestamp(this.viewModel.timestamp)})`;
7273
wrapper.appendChild(secondLineEl);
7374
}

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ Currently this module supports English (`en`) and Hungarian (`hu`) languages. Th
106106

107107
Want to see more languages? Please contribute!
108108

109+
## Customizing the design
110+
111+
You can customize the look and feel of the module via the following CSS classes (from version 1.2.0):
112+
113+
- `symbol`: The style of the icon.
114+
- `temp`: The style of the temperature value.
115+
- `humidity`: The style of the humidity value (if specified and rendered).
116+
- `time`: The style for the timestamp (if configured to show).
117+
109118
## Contribution
110119

111120
Although for operation this module does not depend on any other module, if you would like to contribute to the codebase, please use the preconfigured linters to analyze the source code before sending a pull request. To run the linters follow these steps:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MMM-RemoteTemperature",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "MagicMirror module that displays temperature value from a remote sensor.",
55
"main": "MMM-RemoteTemperature.js",
66
"author": "György Balássy",

0 commit comments

Comments
 (0)