2022-03-08 22:50:35 +01:00
import React from 'react' ;
2022-03-23 21:17:53 +01:00
import {
NETWORK _TYPE _TO _ID _MAP ,
NETWORK _TYPE _RPC ,
} from '../../../../shared/constants/network' ;
import { SIZES } from '../../../helpers/constants/design-system' ;
2022-03-08 22:50:35 +01:00
import NetworkDisplay from '.' ;
export default {
title : 'Components/App/NetworkDisplay' ,
id : _ _filename ,
argTypes : {
indicatorSize : {
2022-03-23 21:17:53 +01:00
control : 'select' ,
options : Object . values ( SIZES ) ,
2022-03-08 22:50:35 +01:00
} ,
labelProps : {
control : 'object' ,
} ,
2022-03-23 21:17:53 +01:00
targetNetwork : {
control : 'select' ,
options : [ ... Object . keys ( NETWORK _TYPE _TO _ID _MAP ) , NETWORK _TYPE _RPC ] ,
2022-03-08 22:50:35 +01:00
} ,
disabled : {
control : 'boolean' ,
} ,
onClick : {
action : 'onClick' ,
2022-03-23 21:17:53 +01:00
description :
'The onClick event handler of the NetworkDisplay. If it is not passed it is assumed that the NetworkDisplay SHOULD NOT be interactive and removes the caret and changes the border color of the NetworkDisplay to border-muted' ,
2022-03-08 22:50:35 +01:00
} ,
} ,
2022-03-23 21:17:53 +01:00
args : {
targetNetwork : 'ropsten' ,
} ,
2022-03-08 22:50:35 +01:00
} ;
2022-03-23 21:17:53 +01:00
export const DefaultStory = ( args ) => (
< NetworkDisplay
{ ... args }
targetNetwork = { {
type : args . targetNetwork ,
nickname : args . targetNetwork ,
} }
/ >
) ;
2022-03-08 22:50:35 +01:00
DefaultStory . storyName = 'Default' ;
2022-03-23 21:17:53 +01:00
export const TargetNetwork = ( args ) => {
const targetNetworkArr = [
... Object . keys ( NETWORK _TYPE _TO _ID _MAP ) ,
NETWORK _TYPE _RPC ,
] ;
return (
< >
{ Object . values ( targetNetworkArr ) . map ( ( variant ) => (
< NetworkDisplay
{ ... args }
key = { variant }
targetNetwork = { {
type : variant ,
nickname : variant ,
} }
/ >
) ) }
< / >
) ;
} ;
export const DisplayOnly = ( args ) => {
const targetNetworkArr = [
... Object . keys ( NETWORK _TYPE _TO _ID _MAP ) ,
NETWORK _TYPE _RPC ,
] ;
return (
< >
{ Object . values ( targetNetworkArr ) . map ( ( variant ) => (
< NetworkDisplay
{ ... args }
key = { variant }
targetNetwork = { {
type : variant ,
nickname : variant ,
} }
onClick = { undefined }
/ >
) ) }
< / >
) ;
} ;