<div id="app" class="container"></div>
@import 'https://fonts.googleapis.com/css?family=Share+Tech+Mono';
@import 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css';
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1376484/jess-harding-lqT6NAmTaiY-unsplash.jpg'),radial-gradient(#28a3dd, #0d7751);
background-size: cover;
background-position: center;
font-family: "Share Tech Mono", monospace;
font-size: 2rem;
background-blend-mode: multiply,screen, overlay;
}
.container {
position: relative;
background-size: cover;
background-position: center;
backdrop-filter: blur(20px);
background-color: rgba(255, 255, 255, 0.5);
border-radius: 5px;
padding:2vw;
box-sizing: border-box;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: .3s ease;
margin: 3vw;
}
.list {
position: relative;
margin: 0;
padding: 0;
border: 1px solid currentColor;
border-radius: 0.5em;
color: rgb(71, 73, 84);
min-width: 60vw;
li {
padding: .5em 1em;
background: #fff;
display: flex;
align-items: center;
&:first-child{
border-radius: .5em .5em 0 0;
}
&:last-child {
border-radius: 0 0 .5em .5em;
}
}
li + li {
border-top: 1px solid currentColor;
}
}
.no__list {
display: flex;
justify-content: center;
align-items: center;
font-size: 1.5rem;
text-align: center;
text-shadow: .05em .05em .01em rgba(0,0,0,.5);
color: #fff;
&::before,
&::after {
content: '';
display: block;
width: 5vw;
height: 1px;
background: #fff;
}
&::before {
margin-right: 2vh;
}
&::after {
margin-left: 2vh;
}
}
View Compiled
const Lists = ({list}) => {
const isList = list && list.length
return (
<>
{ isList ? (
<ul className="list">
{list.map(item => <li className="list__item">{item}</li>)}
</ul>
) : <NoList isNull={!list} isEmpty={list && !list.length} />}
</>
)
}
const NoList = ({isNull, isEmpty}) => {
return (!isNull && isEmpty) && <div className="no__list">任务都处理完了</div>
}
const listsData = ['CSS', 'React', 'Vue', 'HTML5', 'JavaScript']
const rootElement = document.getElementById("app");
ReactDOM.render(<Lists list={listsData}/>, rootElement);
View Compiled
This Pen doesn't use any external CSS resources.