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

feat(shared/system): StyleProps 타입, createRawStyleProps 함수 추가 #156

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions packages/shared/system/src/create-raw-style-props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { type CSSProperties } from 'react';

export type StyleProps<Props extends keyof CSSProperties> = {
[key in Props]?: CSSProperties[key];
};

export function createRawStyleProps<
Props extends StyleProps<keyof CSSProperties>,
>(...styleProps: (keyof Props)[]) {
return styleProps.reduce(
(acc, styleProp) => ({ ...acc, [styleProp]: undefined }),
{} as Record<keyof Props, undefined>,
);
}
1 change: 1 addition & 0 deletions packages/shared/system/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @stylistic/padding-line-between-statements */
export * from './create-component';
export * from './create-context';
export * from './create-raw-style-props';
export * from './factory';
export * from './forward-ref';
export * from './types';
Loading