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#useClasses TypeScript Examples
The following examples show how to use
components#useClasses.
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: index.test.tsx From geist-ui with MIT License | 5 votes |
describe('useClasses', () => {
it('should be return string always', () => {
const str = Math.random().toString()
expect(typeof useClasses(str)).toEqual('string')
expect(typeof useClasses(true)).toEqual('string')
expect(typeof useClasses(null)).toEqual('string')
expect(typeof useClasses(undefined)).toEqual('string')
expect(typeof useClasses({})).toEqual('string')
expect(typeof useClasses(null, undefined)).toEqual('string')
expect(typeof useClasses(1, 0)).toEqual('string')
expect(typeof useClasses(str, { [str]: true })).toEqual('string')
})
it('should be work correctly with string', () => {
const str = Math.random().toString()
expect(useClasses()).toEqual('')
expect(useClasses(str)).toEqual(str)
expect(useClasses('')).toEqual('')
expect(useClasses(`${str} ${str}`)).toEqual(`${str} ${str}`)
})
it('should be work correctly with object', () => {
expect(
useClasses({
a: 1,
b: false,
c: true,
d: true,
}),
).toEqual('a c d')
expect(
useClasses({
test1: false,
test2: false,
}),
).toEqual('')
expect(
useClasses({
test1: true,
test2: true,
test3: null,
test4: undefined,
}),
).toEqual('test1 test2')
})
it('should be work correctly with combination', () => {
expect(useClasses('a', { b: false, c: true }, 'd')).toEqual('a c d')
expect(useClasses('a', 0, 1, { b: false, c: true }, 'd')).toEqual('a 1 c d')
expect(useClasses({ a: false, b: true }, '')).toEqual('b')
})
it('should be remove spaces before and after', () => {
expect(useClasses(' test ')).toEqual('test')
expect(useClasses({ ' a': true })).toEqual('a')
expect(`a${useClasses(' b ', ' c ', undefined)}d`).toEqual('ab cd')
})
})