0.0.30 • Published 5 years ago

alpha-male-widgets v0.0.30

Weekly downloads
86
License
-
Repository
-
Last release
5 years ago

Installation

Install the required node packages via NPM or Yarn

$ yarn add react react-dom alpha-male-widgets

Non React app

Import the CSS file

@import '~alpha-male-widgets/dist/main.css';

Create an HTML element which will serve as a container for the widget

<div id="example" />

Import required packages

import React from 'react'
import ReactDOM from 'react-dom'
import { Standing } from 'alpha-male-widgets'

Render the desired widget, for this example we build a Standing widget

const element = React.createElement
const container = document.querySelector('#example')

ReactDOM.render(
  element(Standing, {
    tournamentId: 47 // premier league
  }),
  container
)

Refresh your page, enjoy the widget


Components

We currently have the following components:

  • Standing table (league table that shows current standings)
  • Events (show results and fixtures for a participant or tournament)

Standing

Render a standing table for a league

Example:

<Standing tournamentId=47 showSeasonSelect=false />

Standing Widget Example

Configuration

tournamentId

Filter the standing table by a specific tournament

  • Type: Number
  • Required: true

seasonId

Filter the standing table by a specific season

If seasonId is not set, the active season of the league will be picked for you

  • Type: Number
  • Required: false

showSeasonSelect

Show the dropdown to select the season

  • Type: Boolean
  • Required: false
  • Default: true `

Events

Render a results or fixtures widget for a specific team or league

Example for future events (fixtures) for a specific participant (Arsenal):

<Events participantId=8650 limit=5 future=true />

Example for old events (results) for a specific tournament (Primera Division):

<Events tournamentId=87 limit=10 future=false />

Configuration

tournamentId

Filter events by a specific tournament

  • Type: Number
  • Required: true (if participantId is null)

participantId

Filter events by a specific participant

  • Type: Number
  • Required: true (if tournamentId is null)

future

Filter events that haven't been played yet

  • Type: Boolean
  • Required: false
  • Default: true

homeTeamFirst

Show the home team as first team (on the left)

  • Type: Boolean
  • Required: false
  • Default: true

limit

Limit the amount of events

  • Type: Number
  • Required: false
  • Default: 6

API endpoints

Sports

Get the available sports

https://sportwidgets.hercules.gigmedia.com/sports

Tournaments

Get the available tournaments for a sport (in this case soccer)

https://sportwidgets.hercules.gigmedia.com/tournaments?sport_id=1

Participants

Get all the participants for a specific tournament (in this case Premier League)

https://sportwidgets.hercules.gigmedia.com/participants?tournament_id=47

Sources

0.0.30

5 years ago

0.0.29

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.1

6 years ago