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-weather-forecast

v0.0.1

Published

Library of react components used for weather forecast from openweather api. Can be used with both pro and free accounts.

Downloads

15

Readme

react-weather-forecast

Collection of react components used to display weather at any location.

List of used components

  1. WeatherList - lists weather-related values such as rain or snow
  2. WeatherConditions - lists single or multiple (boolean param list) weather phenomena with localized description and icons
  3. WeatherGraph - experimental english only simple graph display
  4. weatherEnhancer - injects weather information into any of your compoments (props added: data)

Examples of use

Component setup


// Set up global configuration for weather components
<WeatherGlobal
    apiKey={state.setApiKey}
    by="day"
    from={new Date()}
    to={threeDaysLater}
    loadingHandler={() => <div>Loading...</div>}
    errorHandler={() => <div>Error!</div>}
    storage={localStorage}
    dateHandler={date => <span>{date.toLocaleDateString() + " " + date.toLocaleTimeString()}</span>}
    units="metric"
    lang="cz"
>
    {/* List how much it rains in Prague */}
    {<WeatherList kind="names" names={["Prague"]} type="rain" />}
    {/* List what kind of weather is in Prague */}
    {<WeatherConditions kind="geo" lat={50.073658} lon={14.418540} list />}
    {/* List only cloudy types of weather */}
    {<WeatherConditions kind="geo" lat={50.073658} lon={14.418540} type="Clouds" />}
    {/* List temperature in Prague */}
    {<WeatherGraph kind="ids" ids={[3067696]} type="clouds" label="Temperature" />}
    {/* List temperature with custom extended component */}
    {<ExtendedTemperatureInfo label="Temp" />}
    {/* List weather phenomena with custom extended component */}
    {<ExtendedWeatherInfo label="Weather list" />}
</WeatherGlobal>

Enhancer use


export interface ExtendedTemperatureProps extends InfoQueryEnhancerProps {
    label: string;
}

const ExtendedTemperature: FunctionComponent<ExtendedTemperatureProps> = props => (
    <div>
        <h3>
            {props.label}
        </h3>
        <ul>
            {props.data.map(result => <li>{result.value}</li>)}
        </ul>
    </div>
);

export default weatherEnhancer(ExtendedTemperature, {
    kind: 'names',
    names: ['Prague', 'cz'],
    type: 'temp_max',
});

forecast-query

For non-react use refer to package https://www.npmjs.com/package/forecast-query

If you have any ideas or have discovered any bugs, please report them, I will take a look as soon as possible.