-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: components from jsx to tsx (#509)
* refactor: App.jsx to App.tsx * refactor(test): setupTests.js to setupTests.ts * refactor(test): App.test.jsx to App.test.tsx * refactor(ts): ActivityIndicators.jsx to .tsx * refactor(ts): Alert.jsx to .tsx * refactor: remove unneeded global declaration * refactor(ts): JarSelectorModal.jsx to .tsx * fix: prefer direct usage of classnames instead of bind
- Loading branch information
1 parent
5669be0
commit d043353
Showing
17 changed files
with
169 additions
and
126 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,44 @@ | ||
import { PropsWithChildren } from 'react' | ||
import classNames from 'classnames' | ||
import Sprite from './Sprite' | ||
|
||
interface ActivityIndicatorProps { | ||
isOn: boolean | ||
} | ||
|
||
function ActivityIndicator({ isOn, children }: PropsWithChildren<ActivityIndicatorProps>) { | ||
return ( | ||
<span className={`activity-indicator ${isOn ? 'activity-indicator-on' : 'activity-indicator-off'}`}> | ||
{children} | ||
</span> | ||
) | ||
} | ||
|
||
interface JoiningIndicatorProps { | ||
isOn: boolean | ||
size: number | ||
className?: string | ||
} | ||
|
||
export function JoiningIndicator({ isOn, size = 30, className = '', ...props }: JoiningIndicatorProps) { | ||
return ( | ||
<span className="joining-indicator"> | ||
<ActivityIndicator isOn={isOn}> | ||
{isOn && <Sprite symbol="joining" width={size} height={size} className={`p-1 ${className}`} {...props} />} | ||
</ActivityIndicator> | ||
</span> | ||
) | ||
} | ||
|
||
interface TabActivityIndicatorProps { | ||
isOn: boolean | ||
className?: string | ||
} | ||
|
||
export function TabActivityIndicator({ isOn, className }: TabActivityIndicatorProps) { | ||
return ( | ||
<span className={classNames('earn-indicator', className)}> | ||
<ActivityIndicator isOn={isOn} /> | ||
</span> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
import { useState } from 'react' | ||
import { Alert as BsAlert, AlertProps as BsAlertProps } from 'react-bootstrap' | ||
|
||
export type SimpleMessageAlertProps = BsAlertProps & { message: string } | ||
|
||
export default function Alert({ message, onClose, ...props }: SimpleMessageAlertProps) { | ||
const [show, setShow] = useState(true) | ||
|
||
return ( | ||
<BsAlert | ||
className="my-3" | ||
onClose={(a: any, b: any) => { | ||
setShow(false) | ||
onClose && onClose(a, b) | ||
}} | ||
show={show} | ||
{...props} | ||
> | ||
{message} | ||
</BsAlert> | ||
) | ||
} |
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
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
Oops, something went wrong.