LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
CSS
* {
  font-family: system-ui;
  margin: 0;
  padding: 0;
}

body {
  width: 100%;
  height: 100%;
}

main {
  display: flex;
  background: #FAFAFC;
  width: 100%;
  height: 100%;
  position: relative;
}

.sidebar {
  width: 300px;
  background-image: linear-gradient(#FCBD78, #FF65C3);
  background-size: 200%;
  background-position: 0 100%;
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  -webkit-transform: translateX(-230px);
          transform: translateX(-230px);
  transition: 300ms ease-in-out;
  z-index: 1;
  overflow: hidden;
  cursor: pointer;
}
.sidebar--expanded {
  background-size: 100%;
  background-position: 0 0;
  -webkit-transform: translateX(0);
          transform: translateX(0);
}
.sidebar:hover {
  background-position: 0 0;
}

.sidebar__toggle {
  width: 100%;
  height: 100%;
  height: 4rem;
  position: absolute;
  top: 0;
  left: 0;
  border: none;
  background: transparent;
  font-size: 20px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 1.8rem;
  padding-bottom: 0;
  transition: 300ms ease;
  cursor: pointer;
}
.sidebar__toggle:focus {
  outline: none;
}

.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 3% 4rem;
  margin-left: 4.5rem;
  transition: 300ms ease-in-out;
  position: relative;
  z-index: 2;
}
.main-content--expanded {
  margin-left: 310px;
}

.main-content header {
  height: 5rem;
  width: 100%;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 2rem;
}

.main-content header span {
  width: 16rem;
  height: 2rem;
  background: #E5E5E7;
}

.main-content header ul {
  list-style: none;
  display: flex;
  align-items: center;
}

.main-content header ul li {
  width: 6rem;
  height: 2rem;
  margin: 0 1rem;
  background: #E5E5E7;
}
.main-content header ul li:last-child {
  margin-right: 0;
}

.main-content .container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
}

.main-content .module--full {
  width: 100%;
  height: 400px;
  box-shadow: 0 3px 8px rgba(211, 211, 211, 0.1), 0 6px 7px rgba(211, 211, 211, 0.1);
  background: white;
}

.main-content .module-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.main-content .module--half {
  flex: 1;
  height: 400px;
  box-shadow: 0 3px 8px rgba(211, 211, 211, 0.1), 0 6px 7px rgba(211, 211, 211, 0.1);
  background: white;
}
.main-content .module--half:first-child {
  margin-right: 1rem;
}

.shape {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  background: linear-gradient(#FF7DD5 80%, transparent);
  height: 370px;
  border-radius: 100%;
  margin-left: -100px;
  margin-top: -20px;
  z-index: -1;
  opacity: 0;
  -webkit-transform: scale(0.4) translateY(-400px) translateX(300px);
          transform: scale(0.4) translateY(-400px) translateX(300px);
  margin-left: 0;
  margin-top: 0;
  transition: 400ms ease;
}
.shape:nth-child(2) {
  background: linear-gradient(#FCBD78 80%, transparent);
  margin-top: 70px;
  margin-left: 50px;
  -webkit-transform: scale(0.4) translateY(-400px);
          transform: scale(0.4) translateY(-400px);
  margin-top: 0;
}
.sidebar--expanded .shape {
  -webkit-animation: float 6s infinite alternate;
          animation: float 6s infinite alternate;
  margin-left: -100px;
  margin-top: -20px;
  opacity: .4;
  -webkit-transform: scale(1) translateY(0);
          transform: scale(1) translateY(0);
}
.sidebar--expanded .shape:nth-child(2) {
  -webkit-animation: float 20s infinite alternate;
          animation: float 20s infinite alternate;
  -webkit-transform: scale(1) translateY(100px) translateX(170px);
          transform: scale(1) translateY(100px) translateX(170px);
}

@-webkit-keyframes float {
  20% {
    top: 0;
    left: -100px;
  }
  50% {
    left: 0;
  }
  100% {
    top: 500px;
    left: -100px;
  }
}

@keyframes float {
  20% {
    top: 0;
    left: -100px;
  }
  50% {
    left: 0;
  }
  100% {
    top: 500px;
    left: -100px;
  }
}
JS
class Sidebar extends React.Component {
  render() {
    return (
      
) } } class MainContent extends React.Component { render() { return (
) } } class App extends React.Component { constructor(props) { super(props); this.state = { expanded: false } } toggleSidebar() { this.setState({ expanded: !this.state.expanded }) } render() { return (
); } } ReactDOM.render(, document.querySelector('#app'));

Description

Animated and expandable gradient sidebar created with React and SCSS.
Term
Sat, 04/14/2018 - 20:49

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv