-
Notifications
You must be signed in to change notification settings - Fork 13
Transition project to typescript #6
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
base: master
Are you sure you want to change the base?
Changes from all commits
1f3a8d4
4f20662
4b8e5f5
af1df11
ddc2f17
23f3efe
1cb8461
b0dd6e7
9b1ecf8
aeb5a3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,85 +1,85 @@ | ||
| .Button { | ||
| padding: 5px; | ||
| border: 1px solid #2151f5; | ||
| padding: 11px 16px; | ||
| border-radius: 4px; | ||
| font-size: 15px; | ||
| font-weight: 600; | ||
| background-color: #2151f5; | ||
| color: white; | ||
| cursor: pointer; | ||
| padding: 5px; | ||
| border: 1px solid #2151f5; | ||
| padding: 11px 16px; | ||
| border-radius: 4px; | ||
| font-size: 15px; | ||
| font-weight: 600; | ||
| background-color: #2151f5; | ||
| color: white; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .Button:hover { | ||
| background-color: #1d48d6; | ||
| background-color: #1d48d6; | ||
| } | ||
|
|
||
| .Button:disabled { | ||
| cursor: not-allowed; | ||
| } | ||
|
|
||
| .btn-secondary { | ||
| background-color: white; | ||
| color: black; | ||
| border: 1px solid #d8d8d8; | ||
| background-color: white; | ||
| color: black; | ||
| border: 1px solid #d8d8d8; | ||
| } | ||
|
|
||
| .btn-secondary:hover { | ||
| background-color: rgb(241, 241, 241); | ||
| background-color: rgb(241, 241, 241); | ||
| } | ||
|
|
||
| .btn-danger { | ||
| background-color: #cf202f; | ||
| color: white; | ||
| border: 1px solid #cf202f; | ||
| background-color: #cf202f; | ||
| color: white; | ||
| border: 1px solid #cf202f; | ||
| } | ||
|
|
||
| .btn-danger:hover { | ||
| background-color: rgb(233, 66, 66); | ||
| background-color: rgb(233, 66, 66); | ||
| } | ||
|
|
||
| .btn-xl { | ||
| padding: 22px; | ||
| width: 100%; | ||
| padding: 22px; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .btn-xxl { | ||
| padding: 32px; | ||
| width: 100%; | ||
| padding: 32px; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .btn-stretch { | ||
| width: 100%; | ||
| } | ||
|
|
||
| .btn-disabled { | ||
| cursor: not-allowed; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .btn-light { | ||
| border: none; | ||
| background-color: white; | ||
| border: none; | ||
| background-color: white; | ||
| } | ||
|
|
||
| .btn-light.btn-primary { | ||
| color: #2151f5; | ||
| color: #2151f5; | ||
| } | ||
|
|
||
| .btn-light.btn-primary:hover { | ||
| color: #1d48d6; | ||
| background-color: white; | ||
| color: #1d48d6; | ||
| background-color: white; | ||
| } | ||
|
|
||
| .btn-light.btn-secondary { | ||
| color: black; | ||
| color: black; | ||
| } | ||
|
|
||
| .btn-light.btn-secondary:hover { | ||
| color: black; | ||
| background-color: white; | ||
| color: black; | ||
| background-color: white; | ||
| } | ||
|
|
||
| .btn-light.btn-danger { | ||
| color: #cf202f; | ||
| color: #cf202f; | ||
| } | ||
|
|
||
| .btn-light.btn-danger:hover { | ||
| color: #cf202f; | ||
| background-color: white; | ||
| color: #cf202f; | ||
| background-color: white; | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import './Content.css'; | ||
|
|
||
| import { FC, ReactNode } from 'react'; | ||
|
|
||
| interface ContentProps { | ||
| children: ReactNode; | ||
| } | ||
|
|
||
| const Content: FC<ContentProps> = ({ children }) => <div className='Content'>{children}</div>; | ||
|
|
||
| export default Content; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import './ContentCenter.css'; | ||
|
|
||
| import { FC, ReactNode } from 'react'; | ||
|
|
||
| interface ContentCenterProps { | ||
| children: ReactNode; | ||
| } | ||
|
Comment on lines
+5
to
+7
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to admit First, I stumbled upon sooo many ressources discouraging the use of FC, e.g. https://fettblog.eu/typescript-react-why-i-dont-use-react-fc/. Then, based on you comment I tried FC without children, but get Typescript errors. Here is what I tried: Error message: 'Property children does not exist on type {}'. What am I doing wrong? |
||
|
|
||
| const ContentCenter: FC<ContentCenterProps> = ({ children }) => { | ||
| return <div className='ContentCenter'>{children}</div>; | ||
| }; | ||
|
|
||
| export default ContentCenter; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import './ContentRight.css'; | ||
|
|
||
| import { FC, ReactNode } from 'react'; | ||
|
|
||
| interface ContentRightProps { | ||
| children: ReactNode; | ||
| } | ||
|
|
||
| const ContentRight: FC<ContentRightProps> = ({ children }) => { | ||
| return <div className='ContentRight'>{children}</div>; | ||
| }; | ||
|
|
||
| export default ContentRight; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FCalready has types forchildren, so no need to put it here.childrenareReactNodeAFAIK, notstring. (ReactNodeincludesstring)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, thanks. I read afterwards that it's a good idea to make it explicit, when a component is accepting children (as some components don't). Thus it might be good to leave it. Do you agree?
In this Button case I actually only want text as children. Is string ok then because it is more specific?