generated from eternallycyf/ims-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
e5ef6fb
commit c1c2b5a
Showing
8 changed files
with
181 additions
and
3 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
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,58 @@ | ||
.msg { | ||
position: absolute; | ||
right: 8px; | ||
bottom: 0; | ||
left: 8px; | ||
z-index: 10; | ||
|
||
display: flex; | ||
max-height: calc(100% - 300px); | ||
min-height: 40px; | ||
margin-bottom: 8px; | ||
color: var(--color); | ||
|
||
background-color: var(--bg-color); | ||
border: 2px solid #fff; | ||
border-radius: 6px; | ||
|
||
align-items: stretch; | ||
border-color: var(--color); | ||
|
||
&.error { | ||
--color: #f56c6c; | ||
--bg-color: #fef0f0; | ||
} | ||
|
||
&.warn { | ||
--color: #e6a23c; | ||
--bg-color: #fdf6ec; | ||
} | ||
} | ||
|
||
pre { | ||
padding: 12px 20px; | ||
margin: 0; | ||
overflow: auto; | ||
white-space: break-spaces; | ||
} | ||
|
||
.dismiss { | ||
position: absolute; | ||
top: 2px; | ||
right: 2px; | ||
|
||
display: block; | ||
width: 18px; | ||
height: 18px; | ||
padding: 0; | ||
|
||
font-size: 9px; | ||
line-height: 18px; | ||
color: var(--bg-color); | ||
|
||
text-align: center; | ||
cursor: pointer; | ||
background-color: var(--color); | ||
border: none; | ||
border-radius: 9px; | ||
} |
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,27 @@ | ||
import classnames from 'classnames'; | ||
Check warning on line 1 in src/components/Playground/components/Message/index.tsx GitHub Actions / test
|
||
import React, { useEffect, useState } from 'react'; | ||
|
||
import './index.css'; | ||
|
||
export interface MessageProps { | ||
type: 'error' | 'warn'; | ||
content: string; | ||
} | ||
|
||
export const Message: React.FC<MessageProps> = (props) => { | ||
const { type, content } = props; | ||
const [visible, setVisible] = useState(false); | ||
|
||
useEffect(() => { | ||
setVisible(!!content); | ||
}, [content]); | ||
|
||
return visible ? ( | ||
<div className={['msg', type].join(' ')}> | ||
<pre dangerouslySetInnerHTML={{ __html: content }}></pre> | ||
<button type="button" className="dismiss" onClick={() => setVisible(false)}> | ||
✕ | ||
</button> | ||
</div> | ||
) : null; | ||
}; |
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