Skip to content

Commit

Permalink
feat(styling): add sx method
Browse files Browse the repository at this point in the history
add sx method to combine stylings

resolves #20

Signed-off-by: Niloy Sikdar <niloysikdar30@gmail.com>
  • Loading branch information
niloysikdar committed Jun 24, 2022
1 parent d63e05a commit 1042629
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Email/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Email, EmailProps } from './Email';
export * from './Email';
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Email, EmailProps } from './components/Email';
export * from './components/Email';
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './stylings';
15 changes: 15 additions & 0 deletions src/utils/stylings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { CSSProperties } from 'react';

// interface CSSClasses {
// [key: string]: CSSProperties;
// }

export const sx = (...args: CSSProperties[]): CSSProperties => {
const initialValue: CSSProperties = {};

const result = args.reduce((prev: CSSProperties, curr: CSSProperties) => {
return { ...prev, ...curr };
}, initialValue);

return result;
};

0 comments on commit 1042629

Please sign in to comment.