-
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 * Extract `SizeableProps` type * Extract `MarginalSubComponentProps` type for Header and Footer * Remove unnecessary `MediaProps` type * Moved the `className` prop to the `MarginalSubComponentProps` type
- Loading branch information
Showing
8 changed files
with
108 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,81 @@ | ||
/** | ||
* 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'; | ||
|
||
type SizeableProps = { | ||
/** | ||
* Determines the amount of padding within the component. | ||
* | ||
* @default 'medium' | ||
*/ | ||
size?: SizeOptions; | ||
}; | ||
|
||
export type Props = SurfaceProps & | ||
SizeableProps & { | ||
/** | ||
* Renders without a border. | ||
* | ||
* @default false | ||
*/ | ||
isBorderless?: boolean; | ||
/** | ||
* Renders with rounded corners. | ||
* | ||
* @default true | ||
*/ | ||
isRounded?: boolean; | ||
/** | ||
* Renders with elevation styles (box shadow). | ||
* | ||
* @default false | ||
*/ | ||
isElevated?: boolean; | ||
}; | ||
|
||
type BaseSubComponentProps = SizeableProps & { | ||
/** | ||
* The children elements. | ||
*/ | ||
children: React.ReactNode; | ||
/** | ||
* Renders with a light gray background color. | ||
* | ||
* @default false | ||
*/ | ||
isShady?: boolean; | ||
}; | ||
|
||
export type BodyProps = BaseSubComponentProps & { | ||
/** | ||
* Determines if the component is scrollable. | ||
* | ||
* @default true | ||
*/ | ||
isScrollable?: boolean; | ||
}; | ||
|
||
type MarginalSubComponentProps = BaseSubComponentProps & { | ||
/** | ||
* Renders without a border. | ||
* | ||
* @default false | ||
*/ | ||
isBorderless?: boolean; | ||
className?: string; | ||
}; | ||
|
||
export type HeaderProps = MarginalSubComponentProps; | ||
|
||
export type FooterProps = MarginalSubComponentProps & { | ||
justify: CSSProperties[ 'justifyContent' ]; | ||
}; |
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