Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
馃挬 More theme changes + new message component!
- Loading branch information
1 parent
e703f0c
commit 731b230
Showing
12 changed files
with
149 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# @precursor/message |
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,35 @@ | ||
/** @jsx jsx */ | ||
import { FC, ReactNode } from 'react'; | ||
import { jsx } from '@trousers/core'; | ||
import collector from '@trousers/collector'; | ||
|
||
import { Theme } from '@precursor/theme'; | ||
|
||
export interface MessageProps { | ||
status?: 'error' | 'success' | 'warning'; | ||
children: ReactNode; | ||
} | ||
|
||
const styles = (status: MessageProps['status']) => | ||
collector<Theme>('message').element` | ||
display: block; | ||
padding: ${({ spacePreset }) => spacePreset.inset}; | ||
border-radius: ${({ radius }) => radius.m}; | ||
background-color: ${({ color }) => color.info.light}; | ||
color: ${({ color }) => color.info.base}; | ||
`.modifier(status === 'error')` | ||
background-color: ${({ color }) => color.error.light} | ||
color: ${({ color }) => color.error.base} | ||
`.modifier(status === 'warning')` | ||
background-color: ${({ color }: Theme) => color.warning.light} | ||
color: ${({ color }: Theme) => color.warning.base} | ||
`.modifier(status === 'success')` | ||
background-color: ${({ color }: Theme) => color.success.light} | ||
color: ${({ color }: Theme) => color.success.base} | ||
`; | ||
|
||
const Message: FC<MessageProps> = props => { | ||
return <div css={styles(props.status)}>{props.children}</div>; | ||
}; | ||
|
||
export default Message; |
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 @@ | ||
export { default, MessageProps } from './Message'; |
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,22 @@ | ||
{ | ||
"name": "@precursor/message", | ||
"version": "0.1.0", | ||
"description": "message component", | ||
"main": "dist/index.js", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@precursor/text": "^0.1.4", | ||
"@precursor/theme": "^0.1.5", | ||
"@trousers/collector": "^3.0.2", | ||
"@trousers/core": "^3.0.2" | ||
}, | ||
"devDependencies": { | ||
"react": "^16.8.1" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.8.0" | ||
}, | ||
"repository": "https://github.com/danieldelcore/precursor/tree/master/packages/components/message" | ||
} |
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,17 @@ | ||
{ | ||
"include": ["*.tsx", "*.ts"], | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": ".", | ||
"baseUrl": "." | ||
}, | ||
"references": [ | ||
{ | ||
"path": "../../theming/theme" | ||
}, | ||
{ | ||
"path": "../../elements/text" | ||
} | ||
] | ||
} |
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