-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
285 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import styled from '@morfeo/styled-components-web'; | ||
|
||
export const Box = styled.Box({}); |
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,3 @@ | ||
import styled from '@morfeo/styled-components-web'; | ||
|
||
export const Button = styled.Button({}); |
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,3 @@ | ||
import styled from '@morfeo/styled-components-web'; | ||
|
||
export const Typography = styled.Typography({}); |
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,3 @@ | ||
export * from './Box'; | ||
export * from './Button'; | ||
export * from './Typography'; |
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 |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import { Style } from './style'; | ||
|
||
type ComponentStyle = Style & { | ||
componentTag?: string; | ||
type ComponentStyle<Props extends Style = Style> = { | ||
tag?: string; | ||
style: Style; | ||
props: Props; | ||
}; | ||
|
||
export type ComponentConfig< | ||
Variant extends string = string, | ||
Props extends Style = Style, | ||
> = { | ||
style: ComponentStyle; | ||
props: Props; | ||
variants: Record<Variant, ComponentStyle>; | ||
> = ComponentStyle<Props> & { | ||
variants: Record<Variant, ComponentStyle<Props>>; | ||
}; | ||
export interface Components { | ||
Box: ComponentConfig; | ||
} | ||
|
||
export type Component = keyof Components; | ||
|
||
export type Variant<C extends Component> = keyof Components[C]['variants']; | ||
|
||
export type ComponentProps<C extends Component = Component> = { | ||
componentName?: C; | ||
variant?: keyof Components[C]['variants']; | ||
variant?: Variant<C>; | ||
}; |
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,15 @@ | ||
import React, { FC, useEffect, useState } from 'react'; | ||
import { theme } from '@morfeo/web'; | ||
import { ThemeProvider as StyledProvider } from 'styled-components'; | ||
|
||
type Props = Omit<React.ComponentProps<typeof StyledProvider>, 'theme'>; | ||
|
||
export const ThemeProvider: FC<Props> = ({ children }) => { | ||
const [currentTheme, setTheme] = useState(theme.get()); | ||
|
||
useEffect(() => { | ||
theme.listen(setTheme); | ||
}, []); | ||
|
||
return <StyledProvider theme={currentTheme}>{children}</StyledProvider>; | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { morfeoStyled, propsParser } from './styled'; | ||
import { morfeoStyled, propsParser, attributesParser } from './styled'; | ||
export * from 'styled-components'; | ||
export * from './types'; | ||
|
||
export { propsParser }; | ||
export { propsParser, attributesParser }; | ||
export default morfeoStyled; | ||
export { ThemeProvider } from './ThemeProvider'; |
Oops, something went wrong.