Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style engine: refine Box type #38894

Merged
merged 2 commits into from
Feb 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Allow for BoxVariant to be undefined
  • Loading branch information
ciampo committed Feb 21, 2022
commit fa85133e7b97a7b0a9039a7992dfe54cb7380f54
12 changes: 6 additions & 6 deletions packages/style-engine/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/
import type { CSSProperties } from 'react';

type BoxVariants = 'margin' | 'padding';
export type Box< T extends BoxVariants = 'margin' > = {
top?: CSSProperties[ `${ T }Top` ];
right?: CSSProperties[ `${ T }Right` ];
bottom?: CSSProperties[ `${ T }Bottom` ];
left?: CSSProperties[ `${ T }Left` ];
type BoxVariants = 'margin' | 'padding' | undefined;
export type Box< T extends BoxVariants = undefined > = {
top?: CSSProperties[ T extends undefined ? 'top' : `${ T }Top` ];
right?: CSSProperties[ T extends undefined ? 'right' : `${ T }Right` ];
bottom?: CSSProperties[ T extends undefined ? 'bottom' : `${ T }Bottom` ];
left?: CSSProperties[ T extends undefined ? 'left' : `${ T }Left` ];
};

export interface Style {
Expand Down