npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-thermostat

v2.0.2

Published

A Controller to display temperature or use with a smart home integration like home assistant (react application talking to web sockets or rest api)

Downloads

61

Readme

React Thermostat

version

A react thermostat which can be easily plugged into any smart home application, I've used this with Home Assistant connecting to websockets for a standalone smart home application and it's working great.

Online Demo

Help me out?

I've spent a lot of time on this, you're free to use it but would appreciate a small donation if you're feeling generous! Buy me a beer!

Buy me a beer!

Install

  npm i react-thermostat

Example

The size of the thermostat is relative to it's parent and automatically will adjust on resize, you can also set the size of the thermostat by setting the width of the parent container.

import React, { useState } from 'react';
import styled from '@emotion/styled';
import { Thermostat } from 'react-thermostat';
const Container = styled.div`
  width: 100%;
  max-width: 300px;
`;
const App = () => {
    const [value, setValue] = useState(50);
    return (
      <Container>
        <Thermostat
          value={value}
          onChange={ newValue => setValue(Number(newValue.toFixed(0))) }
        />
      </Container>
    )
};
export default App;

Main Props

| prop | type | required | default | description | |-------------|------------------------------|----------|------------------------------|--------------------------------------------------------------------------------------------------| | value | number | yes | | The value for the thermostat | | onChange | (value: number) => void | yes | | Called when a user interacts with the handle, you should update your value with this callback, this value is NOT rounded intentionally. | | valueSuffix | string | no | ° | The suffix for the value, use '' if you don't want a suffix | | min | number | no | 0 | The minimum value for the thermostat | | max | number | no | 100 | The maximum value for the thermostat | | handle | HandleProps | no | HandleProps | The props for the dragging handle | | disabled | boolean | no | false | If the thermostat should be disabled | | track | TrackProps | no | TrackProps | The props for the track |

Handle Props

| prop | type | required | default | description | |--------|--------------------------------|----------|--------------------------------|----------------------------| | size | number | no | size / 15 | The size of the handle | | colors | HandleColors | no | HandleColors | The colours for the handle |

Handle Colors

| prop | type | required | default | description | |--------|--------|----------|-----------------|-------------------------------------------------| | handle | string | no | #fff | The background color of the handle | | icon | string | no | #111 | The color of the icon in the handle | | pulse | string | no | rgba(0,0,0,0.3) | The color of the pulse effect behind the handle |

Track Props

| prop | type | required | default | description | |-----------|---------------------------|----------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------| | colors | string[] | no | ['#cfac48', '#cd5401'] | The colours of the track gradient, from left to right, this can be one or many colours and will apply in a conical gradient effect | | thickness | number | no | size / 10 | The thickness of the main arc track, the inner thermometer will divide it's track size by 1.4 | | markers | Markers | no | Markers | The options for the markers on the arc track, this is really only for advanced control |

Markers Props

| prop | type | required | default | description | |----------------|---------|----------|---------------------|---------------------------------------------------| | enabled | boolean | no | true | If the markers on the arc track should be enabled | | every | number | no | 5 | Every 5 ticks will be the "main" mark | | count | | no | 60 | The number of marks to include on the arc | | main.color | string | no | black | The colour of the main mark | | main.length | number | no | track.thickness / 4 | The length of the mark | | main.thickness | number | no | 2 | The thickness of the mark | | sub.color | string | no | rgba(0,0,0,0.8) | The colour of the sub mark | | sub.length | number | no | track.thickness / 8 | The length of the sub mark | | sub.thickness | number | no | 1 | The thickness of the sub mark |

Developer

Once the repository has been checked out, simply run npm run dev which will spawn a local webserver.

Any changes made in the src direction will appear in the demo page created.

Publishing

This is a very simple package setup, no tagging in place for now, increment the package version, npm run build and push all your changes then run npm publish