REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.40 KB
Close
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/@adminjs/design-system/src/atoms/badge/badge.tsx
Text
Base64
import { color, space, typography, SpaceProps, TypographyProps, variant } from 'styled-system' import { styled } from '@styled-components' import { VariantType } from '../../theme.js' import { NewColorProps as ColorProps } from '../../utils/color-props.js' import { cssClass } from '../../utils/css-class.js' /** * @load ./badge-props.doc.md * @memberof Badge * @alias BadgeProps * @property {string} [...] Other props from {@link ColorProps}, {@link SpaceProps} * and {@link TypographyProps} */ export type BadgeProps = SpaceProps & TypographyProps & ColorProps & { /** * Color variant */ variant?: VariantType; /** * Outline version */ outline?: boolean; /** * Size variant */ size?: 'sm' | 'lg' | 'default'; } const variantStyle = (variantColor: string, props: BadgeProps): Record<string, any> => ({ bg: variantColor, borderColor: variantColor, color: props.outline ? variantColor : 'white', }) const colorVariant = (props: BadgeProps): Record<string, any> => variant({ variants: { primary: variantStyle('primary100', props), danger: variantStyle('error', props), success: variantStyle('success', props), info: variantStyle('info', props), secondary: variantStyle('accent', props), light: variantStyle('light', props), default: {}, }, }) const sizeVariants = variant({ prop: 'size', variants: { sm: { py: 'xs', }, lg: { py: '11px', px: '14px', }, default: {}, }, }) /** * @load ./badge.doc.md * @see BadgeProps * @see {@link https://storybook.adminjs.co/?path=/story/designsystem-atoms-badge--default StoryBook} * @component * @hideconstructor * @section design-system * @subcategory Atoms */ const Badge = styled.span<BadgeProps>` border-radius: 20px; border: 1px solid ${({ theme }) => theme.colors.grey40}; color: ${({ outline, theme }): string => (outline ? theme.colors.grey60 : theme.colors.white)}; vertical-align: middle; font-family: ${({ theme }) => theme.font}; display: inline; white-space: nowrap; ${space}; ${color}; ${typography}; ${(props): any => colorVariant(props)}; ${sizeVariants}; ${({ outline }): string => (outline ? 'background: transparent;' : '')} ` Badge.defaultProps = { px: 'default', py: 'sm', fontSize: 'sm', bg: 'grey40', className: cssClass('Badge'), } Badge.displayName = 'Badge' export { Badge } export default Badge
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
badge-props.doc.md
237 B
lrw-r--r--
2026-02-28 00:31:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
badge.doc.md
1.75 KB
lrw-r--r--
2026-02-28 00:31:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
badge.stories.tsx
2.23 KB
lrw-r--r--
2026-02-28 00:31:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
badge.tsx
2.40 KB
lrw-r--r--
2026-02-28 00:31:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.ts
28 B
lrw-r--r--
2026-02-28 00:31:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).