-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add types to
<Card />
and its subcomponents
- Loading branch information
Showing
8 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
// eslint-disable-next-line no-restricted-imports | ||
import type { CSSProperties } from 'react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { Props as SurfaceProps } from '../surface/types'; | ||
|
||
export type SizeOptions = 'xSmall' | 'small' | 'medium' | 'large'; | ||
|
||
export type Props = SurfaceProps & { | ||
/** | ||
* Renders without a border. | ||
* | ||
* @default false | ||
*/ | ||
isBorderless?: boolean; | ||
/** | ||
* Renders with rounded corners. | ||
* | ||
* @default true | ||
*/ | ||
isRounded?: boolean; | ||
/** | ||
* Determines the amount of padding within the component. | ||
* | ||
* @default 'medium' | ||
*/ | ||
size?: SizeOptions; | ||
/** | ||
* Renders with elevation styles (box shadow). | ||
* | ||
* @default false | ||
*/ | ||
isElevated?: boolean; | ||
}; | ||
|
||
type BaseSubComponentProps = { | ||
/** | ||
* The children elements. | ||
*/ | ||
children: React.ReactNode; | ||
/** | ||
* Renders with a light gray background color. | ||
* | ||
* @default false | ||
*/ | ||
isShady?: boolean; | ||
/** | ||
* Determines the amount of padding within the component. | ||
* | ||
* @default 'medium' | ||
*/ | ||
size?: SizeOptions; | ||
}; | ||
|
||
export type BodyProps = BaseSubComponentProps & { | ||
/** | ||
* Determines if the component is scrollable. | ||
* | ||
* @default true | ||
*/ | ||
isScrollable?: boolean; | ||
}; | ||
|
||
export type HeaderProps = BaseSubComponentProps & { | ||
/** | ||
* Renders without a border. | ||
* | ||
* @default false | ||
*/ | ||
isBorderless?: boolean; | ||
}; | ||
|
||
export type FooterProps = HeaderProps & { | ||
justify: CSSProperties[ 'justifyContent' ]; | ||
}; | ||
|
||
export type MediaProps = { | ||
/** | ||
* The children elements. | ||
*/ | ||
children: React.ReactNode; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters