New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eggtronic/react-weather-widget

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eggtronic/react-weather-widget

A nice weather widget component for react

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

☁️ react-weather-widget ☁️

☁️ A nice weather widget for react based on openweather - Demo

NPM version



Install

NPM


✨ Feature

  • Light Weight - the only peer dependency is styled-components
  • Typescript Support
  • Customizable Theme
  • Geo Detection - detect you geo location by default

🖥 Peer Dependency

  • react: "^16.8.0"
  • react-dom: "^16.8.0"
  • styled-components: "^4.0.0"

🌈 Usage

  • Basic

    import React from 'react';
    import WeatherWidget from '@eggtronic/react-weather-widget';
    
    function Basic() {
      const key = 'xxx'; // your openweathermap api key
    
      return (
        <WeatherWidget apiKey={key} />
      );
    }
    
  • Theme

    import React from 'react';
    import WeatherWidget, {
      darkTheme,
      lightTheme,
      defaultTheme
    } from '@eggtronic/react-weather-widget';
    function Theme() {
      const key = 'xxx'; // your openweathermap api key
    
      return (
        <WeatherWidget 
          apiKey={key} 
          theme={darkTheme}
        />
      );
    }
    
  • Customize Theme

    import React from 'react';
    import WeatherWidget from '@eggtronic/react-weather-widget';
    function CustomTheme() {
      const key = 'xxx'; // your openweathermap api key
      const theme = {
        color: ['#b92b27', '#1565C0'], // graient color of background
        width: '500px', // widget width
        height: '650px', // widget height
        mainFontSize: '24px', // main text size
        subFontSize: '14px', // sub text size
        mainFontColor: '#fff', // main text color
        subFontColor: '#fff', // sub text color
        hrColor: '#fff', // hr line color
    
        // line chart styles
        lineChartPadding: [45, 30],
        lineChartLabelPadding: [-10, -10],
        lineChartColor: '#fff',
        lineChartLabelColor: '#fff',
        lineChartLabelSize: 1,
        lineChartHeight: '120px'
      }
    
      return (
        <WeatherWidget 
          apiKey={key} 
          theme={theme}
        />
      );
    }
    
  • Others

    import {
      WeatherHeader, 
      WeatherHourly, 
      WeatherDaily,
      LineChart
    } from '@eggtronic/react-weather-widget';
    
    // you can use those child components independently
    

📝 Props

NameTypeDefaultDescription
classNamestringAdditional CSS class for the root DOM node
apiKeystringYour api key from OpenWeatherMap
geo{lat: string, lon: string} or undefinedundefinedWidget detects your geo by default, you can also specify your own geo location
themeWeatherWidgetThemedefaultThemeCustomize theme
excludeOpenWeatherMapExcludeundefinedOpenWeatherMap api config, exclude daily/hourly/current wealther data
dayRange[number, number][1, 6]Specify how many days' weather to display (start from next day)
hourRange[number, number][1, 6]Specify how many hours' weather to display (start from next hour)
childrenReactElement[]undefinedReact children

🔨 Development
npm run install
npm run storybook
🧪 Test

npm run test

🔧 Build

npm run build

License

MIT © EggTronic

Keywords

FAQs

Package last updated on 04 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc