@bitrise/bitkit 12.35.1 → 12.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "12.35.1",
4
+ "version": "12.36.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -1,10 +1,24 @@
1
+ import { CardProps } from './Card';
2
+
1
3
  const CardTheme = {
2
- baseStyle: {
3
- _focusVisible: {
4
- boxShadow: 'medium',
5
- },
6
- borderRadius: '8',
7
- border: '1px solid',
4
+ baseStyle: ({ as }: CardProps) => {
5
+ return {
6
+ backgroundColor: 'neutral.100',
7
+ display: 'block',
8
+ width: '100%',
9
+ borderRadius: '8',
10
+ border: '1px solid',
11
+ _focusVisible: {
12
+ boxShadow: 'outline',
13
+ },
14
+ _hover:
15
+ as === 'a' || as === 'button'
16
+ ? {
17
+ backgroundColor: 'neutral.95',
18
+ borderColor: 'neutral.90',
19
+ }
20
+ : undefined,
21
+ };
8
22
  },
9
23
  variants: {
10
24
  elevated: {
@@ -6,7 +6,7 @@ import Box, { BoxProps } from '../Box/Box';
6
6
  export interface CardProps extends BoxProps {
7
7
  borderRadius?: keyof Radii;
8
8
  boxShadow?: keyof Shadows;
9
- withBorder?: boolean;
9
+ href?: string;
10
10
  variant?: 'elevated' | 'outline';
11
11
  }
12
12
 
@@ -14,35 +14,21 @@ export interface CardProps extends BoxProps {
14
14
  * Basic container element with default box shadow and border radius.
15
15
  */
16
16
  const Card = forwardRef<CardProps, 'div'>((props, ref) => {
17
- const { withBorder, variant, ...rest } = props;
18
- const css = useStyleConfig('Card', { variant });
17
+ const { as, variant, ...rest } = props;
18
+ const css = useStyleConfig('Card', { as, variant });
19
19
 
20
20
  const properties = {
21
- backgroundColor: 'white',
22
- display: 'block',
23
- width: '100%',
21
+ as,
24
22
  ...rest,
25
23
  } as BoxProps;
26
- if (!withBorder) {
27
- css.border = 'none';
28
- }
29
24
  if (props.as === 'button' && !(props as HTMLChakraProps<'button'>).type) {
30
25
  (properties as HTMLChakraProps<'button'>).type = 'button';
31
26
  }
32
- // eslint-disable-next-line no-underscore-dangle
33
- if ((props.as === 'a' || props.as === 'button') && !rest._hover) {
34
- // eslint-disable-next-line no-underscore-dangle
35
- properties._hover = {
36
- boxShadow: '0 0 0px 2px var(--colors-purple-50)',
37
- };
38
- }
39
27
  return <Box __css={css} {...properties} ref={ref} />;
40
28
  });
41
29
 
42
30
  Card.defaultProps = {
43
31
  as: 'div',
44
- borderRadius: '8',
45
- withBorder: true,
46
32
  variant: 'elevated',
47
33
  } as CardProps;
48
34