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

fantasy-baseball-ui

v2.1.1

Published

Fantasy Baseball UI is a React-based user interface for displaying various components related to fantasy baseball, such as top stories, scoreboards, standings, and player stats. This project leverages modern web technologies like TypeScript, Tailwind CSS,

Downloads

15

Readme

Fantasy Baseball UI

Fantasy Baseball UI is a React-based user interface for displaying various components related to fantasy baseball, such as top stories, scoreboards, standings, and player stats. This project leverages modern web technologies like TypeScript, Tailwind CSS, and Vite for a seamless development experience.

Table of Contents

Installation

To get started with the project, clone the repository and install the dependencies:

git clone https://github.com/yourusername/fantasy-baseball-ui.git
cd fantasy-baseball-ui
npm install

Components

The project includes several reusable components, each with its own stories for Storybook:

  • TopStory: Displays a top story with an image, headline, and description.

  • Scoreboard: Shows the scoreboard for a match, including team logos, names, records, and scores.

  • Standings: Displays the standings of teams in a division.

  • LatestNews: Lists the latest news items with images and links.

  • PlayerStats: Shows the statistics of players.

  • PlayerStats: Shows the statistics of players.

Usage

To use the components from the Fantasy Baseball UI library in your project, follow these steps:

  1. Install the library: If you haven't already, install the library using npm or yarn.

    npm install fantasy-baseball-ui
  2. Use the components: Use the imported components in your JSX.

    import React from 'react';
    import { TopStory, Scoreboard, Standings, LatestNews, PlayerStats } from 'fantasy-baseball-ui';
    
    const App: React.FC = () => {
      return (
        <div>
          <TopStory
            imageUrl="https://a.espncdn.com/combiner/i?img=%2Fphoto%2F2024%2F0301%2Fr%2Fpittsburgh-penguins-vs-baltimore-orioles_1200_675_x_450.jpg"
            imageAlt="Pittsburgh Penguins vs Baltimore Orioles"
            headline="Pittsburgh Penguins vs Baltimore Orioles"
            description="Pittsburgh Penguins vs Baltimore Orioles"
            link="https://www.mlb.com/news/news/article/2024/03/01/103-nyy-baltimore-orioles-game-news-and-updates"
          />
          <Scoreboard
            date="May-01"
            homeTeam={{
              logoUrl: 'https://midfield.mlbstatic.com/v1/team/147/spots/72',
              name: 'New York Yankees',
              shortName: 'NYY',
              record: '51-26',
              score: 11,
            }}
            awayTeam={{
              logoUrl: 'https://midfield.mlbstatic.com/v1/team/110/spots/72',
              name: 'Baltimore Orioles',
              shortName: 'BAL',
              record: '50-27',
              score: 9,
            }}
            status="In Progress"
            gameUrl="https://www.mlb.com/games/2024/03/01/cws-nyy-103"
          />
          <Standings
            division="AL East"
            teams={[
              {
                name: 'NYY',
                shortName: 'NYM',
                wins: 51,
                losses: 26,
                percentage: '.662',
                gamesBehind: '-',
                logoUrl: 'https://midfield.mlbstatic.com/v1/team/147/spots/72',
              },
              {
                name: 'BAL',
                shortName: 'BAL',
                wins: 49,
                losses: 25,
                percentage: '.662',
                gamesBehind: '0.5',
                logoUrl: 'https://midfield.mlbstatic.com/v1/team/110/spots/72',
              },
              // Add more teams as needed
            ]}
          />
          <LatestNews
            sectionTitle="Latest News"
            newsItems={[
              {
                id: '1',
                href: 'https://www.mlb.com/news/news/article/2024/03/01/103-nyy-baltimore-orioles-game-news-and-updates',
                imgSrc: 'https://a.espncdn.com/combiner/i?img=%2Fphoto%2F2024%2F0301%2Fr%2Fpittsburgh-penguins-vs-baltimore-orioles_1200_675_x_450.jpg',
                imgAlt: '',
                text: 'Pittsburgh Penguins vs Baltimore Orioles',
              },
              {
                id: '2',
                href: 'https://www.mlb.com/news/news/article/2024/03/01/103-nyy-baltimore-orioles-game-news-and-updates',
                imgSrc: 'https://a.espncdn.com/combiner/i?img=%2Fphoto%2F2024%2F0301%2Fr%2Fpittsburgh-penguins-vs-baltimore-orioles_1200_675_x_450.jpg',
                imgAlt: '',
                text: 'Pittsburgh Penguins vs Baltimore Orioles',
              },
            ]}
          />
          <PlayerStats
            players={[
              {
                name: 'Aaron Nola',
                team: 'PHI',
                stats: {
                  G: 10,
                  AB: 5,
                  R: 5,
                  H: 5,
                  '2B': 5,
                  '3B': 5,
                  HR: 5,
                  RBI: 5,
                  BB: 5,
                  SO: 5,
                  SB: 5,
                  CS: 5,
                  AVG: 5,
                  OBP: 5,
                  SLG: 5,
                  OPS: 5,
                },
              },
              {
                name: 'Jimmy Garoppolo',
                team: 'BAL',
                stats: {
                  G: 10,
                  AB: 5,
                  R: 5,
                  H: 5,
                  '2B': 5,
                  '3B': 5,
                  HR: 5,
                  RBI: 5,
                  BB: 5,
                  SO: 5,
                  SB: 5,
                  CS: 5,
                  AVG: 5,
                  OBP: 5,
                  SLG: 5,
                  OPS: 5,
                },
              },
            ]}
          />
        </div>
      );
    };
    
    export default App;

Development

To develop and test the components, use Storybook. Start the Storybook server with:

npm run storybook

or

yarn storybook

Building and Publishing

To build the library, run:

npm run build

or

yarn build

This will generate the distribution files in the dist directory.

To publish a new version of the library:

  1. Update the version number in package.json.
  2. Build the package.
  3. Publish to npm.
npm version patch # or minor/major
npm run build
npm publish

License

This project is licensed under the MIT License.