forked from PrismarineJS/prismarine-web-client
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for world icons in singleplayer menu
- Loading branch information
Showing
17 changed files
with
214 additions
and
140 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 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
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,71 @@ | ||
import { Transition } from 'react-transition-group' | ||
import PixelartIcon from './PixelartIcon' | ||
|
||
// slide up | ||
const startStyle = { opacity: 0, transform: 'translateY(100%)' } | ||
const endExitStyle = { opacity: 0, transform: 'translateY(-100%)' } | ||
const endStyle = { opacity: 1, transform: 'translateY(0)' } | ||
|
||
const stateStyles = { | ||
entering: startStyle, | ||
entered: endStyle, | ||
exiting: endExitStyle, | ||
exited: endExitStyle, | ||
} | ||
const duration = 200 | ||
const basicStyle = { | ||
transition: `${duration}ms ease-in-out all`, | ||
} | ||
|
||
// save pass: login | ||
|
||
export default ({ type = 'message', message, subMessage = '', open, icon = '', action = undefined as (() => void) | undefined }) => { | ||
const isError = type === 'error' | ||
icon ||= isError ? 'alert' : 'message' | ||
|
||
return <Transition | ||
in={open} | ||
timeout={duration} | ||
mountOnEnter | ||
unmountOnExit | ||
> | ||
{state => { | ||
const addStyles = { ...basicStyle, ...stateStyles[state] } | ||
|
||
return <div className={`app-notification ${isError ? 'error-notification' : ''}`} onClick={action} style={{ | ||
position: 'fixed', | ||
top: 0, | ||
right: 0, | ||
width: '160px', | ||
whiteSpace: 'nowrap', | ||
fontSize: '9px', | ||
display: 'flex', | ||
gap: 4, | ||
alignItems: 'center', | ||
padding: '3px 8px', | ||
background: isError ? 'rgba(255, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0.7)', | ||
borderRadius: '0 0 0 5px', | ||
pointerEvents: action ? 'auto' : 'none', | ||
zIndex: 1200, // even above stats | ||
...addStyles | ||
}}> | ||
<PixelartIcon iconName={icon} styles={{ fontSize: 10 }} /> | ||
<div style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 2, | ||
}}> | ||
<div> | ||
{message} | ||
</div> | ||
<div style={{ | ||
fontSize: '7px', | ||
whiteSpace: 'nowrap', | ||
color: 'lightgray', | ||
}}>{subMessage}</div> | ||
</div> | ||
</div> | ||
}} | ||
</Transition> | ||
|
||
} |
Oops, something went wrong.