components APIs
- Header
- Button
- Layout
- Footer
- Text
- Box
- Card
- Table
- Loading
- Select
- Loader
- Toolbar
- Icon
- CodeInput
- BottomSheet
- InfoBlock
- LanguageToggle
- ProgressCircles
- Ripple
- Toggle
- Tag
- Input
- Paginator
- Filter
- AsyncSelect
- CatalogBigButton
- ReadMore
- ConditionalWrapper
- LastCheckedDisplay
- PriceLabel
- PageTitle
- CartTable
- CartFinalPriceTable
- LoadingSpin
- InfoModal
- ProductCard
- RecommendCoupon
- PriceVales
- NomalLayout
- Web3ReactManager
- Popups
- CurrencyInput
- TransactionErrorContent
- TransactionConfirmationModal
- ConfirmationModalContent
- DoubleCurrencyLogo
- CustomModal
- CurrencySearchModal
- CurrencyLogo
- NumericalInput
- Logo
- QuestionHelper
- ListLogo
- DataTable
- WalletModal
- CustomTable
- MinimalPositionCard
- RemoveLiquidityModal
- CustomTooltip
- ColoredSlider
- ToggleSwitch
- FormattedPriceImpact
- SettingsModal
- ConfirmSwapModal
- AdvancedSwapDetails
- AddressInput
- LineChart
- StakeSyrupModal
- AccountDetails
- BetaWarningBanner
- AreaChart
- ChartType
- TokensTable
- PairTable
- TopMovers
- BarChart
- TransactionsTable
- StakeQuickModal
- UnstakeQuickModal
- SyrupCard
- CustomMenu
- SearchInput
- CustomSwitch
- FarmCard
- BuyFiatModal
- MoonpayModal
- RewardSlider
- Swap
- AddLiquidity
- PoolFinderModal
- PoolPositionCard
- SwapTokenDetails
- SuperHeader
- GlobalStyles
- PrimaryButton
- SectionTitle
- Section
- AccentSection
- ChainSelection
- CoinSelection
- AddressSelection
- SendAction
- Buttons
- Content
- Particles
- IconButton
- NotSupported
- InputSearch
- RouteGuard
- SearchBar
- FileInput
- GovBanner
- AuthForm
- DomainDetails
- Subnav
- ColumnFilter
- ImportExport
- selectFilter
- TaggedArrayInput
- FacetFilter
- ButtonSingleLine
- TextMultiline
- ButtonSelect
- BottomSheetBehavior
- InfoButton
- BulletPointX
- BulletPointCheck
- Title
- LoadingIcon
- SelectFilterControls
- CORInputForm
- SdnInputForm
- Navbar
- HomeRoute
- AuthRoute
- DocumentDetails
- DocumentStepper
- AddGame
- Auth
- Effectiveness
- Export
- PokemonType
- Moves
- Member
- MoveSelector
- Type
- Natures
- Move
- PokeInfo
- Share
- Badges
- Status
- UpdateSW
- About
- Builder
- Calculator
- Changelog
- Import
- Pokestats
- Report
- Rules
- Settings
- Tracker
- DarkThemeProvider
- NotificationHandler
- Background
- Indicator
- StyledButton
- StyledText
- Illustration
- OnboardingSlider
- FlexList
- AppLayout
- ScrollableList
- Visualization
- DataSearch
- Region
- App
- CompareApiLegend
- CompareApiBreadcrumbs
- CompareApiLink
- CompareApiCard
- ExploreApiBreadcrumbs
- ExploreApiLink
- ExploreApiSearch
- ExploreApiConst
- ApiLoader
- RefreshButton
- Listing
- PriceModal
- ConfirmationModal
- Transition
- AutoComplete
- useInput
- Avatar
- Badge
- Breadcrumbs
- ButtonDropdown
- ButtonGroup
- Capacity
- Checkbox
- Code
- Collapse
- CssBaseline
- GeistProvider
- Description
- Display
- Divider
- Dot
- Drawer
- useModal
- Fieldset
- Grid
- Image
- Keyboard
- Link
- Modal
- Note
- Page
- Pagination
- Popover
- Progress
- Radio
- Rating
- Slider
- Snippet
- Spacer
- Spinner
- Tabs
- Textarea
- Tooltip
- Tree
- useBodyScroll
- useClasses
- useClickAway
- useClipboard
- useCurrentState
- useKeyboard
- KeyMod
- KeyCode
- useMediaQuery
- useTabs
- useToasts
- User
- useTheme
- Themes
- GeistUIThemes
- useAllThemes
- CollapsableDialog
- Map
- IPForm
- IPMenu
- Container
- Parallax
- Nav
- SEO
- BlogNav
- ExtensionCard
- MenuComp
Other Related APIs
components#CompareApiCard TypeScript Examples
The following examples show how to use
components#CompareApiCard.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CompareApiCard.stories.tsx From substrate-api-explorer with Apache License 2.0 | 6 votes |
storiesOf('COMPONENTS|CompareApiCard', module).add('default', () => {
const nameKnob = text('name', 'fooBar', 'props')
const pathKnob = text('path', 'api.query.foo.bar', 'props')
const existsMainKnob = boolean('exists.main', true, 'props')
const existsComparisonKnob = boolean('exists.comparison', true, 'props')
const mainApiTypeKnob = text('mainApiType', 'number', 'props')
const comparisonApiTypeKnob = text('comparisonApiType', 'string', 'props')
const descriptionKnob = text(
'description',
'This is the description.',
'props'
)
const isNewKnob = boolean('states.isNew', true, 'props')
const isAlteredKnob = boolean('states.isAltered', true, 'props')
return (
<div style={{ maxWidth: 800, padding: '24px' }}>
<CompareApiCard
name={nameKnob}
path={pathKnob}
exists={{ main: existsMainKnob, comparison: existsComparisonKnob }}
mainApiParams={[{ name: 'foo' }, { name: 'bar' }]}
comparisonApiParams={[{ name: 'baz' }, { name: 'qux' }]}
mainApiType={mainApiTypeKnob}
comparisonApiType={comparisonApiTypeKnob}
description={descriptionKnob}
states={{
isNew: isNewKnob,
isAltered: isAlteredKnob
}}
/>
</div>
)
})
Example #2
Source File: Subcategory.tsx From substrate-api-explorer with Apache License 2.0 | 4 votes |
Subcategory = ({ api, apiDiff, match }: Props) => {
const { category, subcategory } = match.params
return (
<S.Wrapper>
<S.Title>
<S.CategoryName>{subcategory}</S.CategoryName>
<CompareApiBreadcrumbs apiName={api.compare.url} match={match} />
</S.Title>
{/* We have to disable ESLint here because it doesn't
play nicely with Prettier */}
{/* eslint-disable indent */}
{_isEmpty(
api.compare.description[category]?.categories[subcategory]?.methods
) ? (
<S.Empty>There's nothing in here ?</S.Empty>
) : (
Object.entries(
api.compare.description[category]?.categories[subcategory]?.methods
)
.sort((a: [string, Method], b: [string, Method]) => {
return a[0] < b[0] ? -1 : 1
})
.map((item: [string, Method], idx) => {
const main =
api.current.description[category]?.categories[subcategory]
?.methods[item[0]]
const comparison =
api.compare.description[category]?.categories[subcategory]
?.methods[item[0]]
const isNew = !main
const isAltered = !!apiDiff.updated[category]?.categories[
subcategory
]?.methods[item[0]]
return (
<CompareApiCard
key={`compareApi-${subcategory}-method-${idx}`}
name={item[0]}
path={`api.${category}.${subcategory}.${item[0]}`}
exists={{ main: !!main, comparison: !!comparison }}
mainApiParams={main?.params}
comparisonApiParams={comparison?.params}
mainApiType={main?.type}
comparisonApiType={comparison?.type}
description={item[1].description}
states={{ isNew, isAltered }}
/>
)
})
)}
{!_isEmpty(
apiDiff.deleted[category]?.categories[subcategory]?.methods
) && (
<>
<S.DividerTitle>Missing in the comparison API</S.DividerTitle>
{Object.keys(
apiDiff.deleted[category]?.categories[subcategory]?.methods
)
.sort((a: string, b: string) => {
return a < b ? -1 : 1
})
.map((item: string, idx) => {
const main =
api.current.description[category]?.categories[subcategory]
?.methods[item]
return (
<CompareApiCard
key={`compareApi-${subcategory}-missing-${idx}`}
name={item}
path={`api.${category}.${subcategory}.${item}`}
exists={{ main: !!main, comparison: false }}
mainApiParams={main?.params}
mainApiType={main?.type}
description={main?.description}
/>
)
})}
</>
)}
{/* eslint-enable indent */}
</S.Wrapper>
)
}