Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              body{
  background: #25A9FC;
}

.box{
  position: relative;
  margin: auto;
  display: block;
  margin-top: 8%;
  width: 600px;
  height: 420px;
  background: none;
  border: solid 3px white;
}

.head{
  position: absolute;
  top:16.5%;
  left: 25%;
  width: 50%;
  height: 67%;
  background: #A6BECF;
  border-radius: 50%;
  z-index: 3;
}

.outer-ear-left{
  position: absolute;
  width: 33%;
  height: 47%;
  left: 17%;
  top: 20%;
  background: #A6BECF;
  border-radius: 50%;
  z-index: 1;
}

.outer-ear-right{
  position: absolute;
  width: 33%;
  height: 47%;
  right: 17%;
  top: 20%;
  background: #A6BECF;
  border-radius: 50%;
  z-index: 1;
}

.inner-ear-left{
  position: absolute;
  border-radius: 50%;
  width: 28%;
  height: 40%;
  top: 23.5%;
  left: 19.5%;
  background: #819CAF;
  z-index: 2;
}

.inner-ear-right{
  position: absolute;
  border-radius: 50%;
  width: 28%;
  height: 40%;
  top: 23.5%;
  right: 19.5%;
  background: #819CAF;
  z-index: 2;
}

.outer-eye-left{
  position: absolute;
  background: white;
  width: 16%;
  height: 22%;
  top: 32%;
  left: 35%;
  border-radius: 50%;
  z-index: 4;
}

.outer-eye-right{
  position: absolute;
  background: white;
  width: 16%;
  height: 22%;
  top: 32%;
  right: 35%;
  border-radius: 50%;
  z-index: 4;
}

.pupil-left{
  position: absolute;
  width: 4.5%;
  height: 7%;
  top: 40%;
  left: 40.5%;
  border-radius: 50%;
  background: #27354A;
  z-index: 5;
} 

.pupil-right{
  position: absolute;
  width: 4.5%;
  height: 7%;
  top: 40%;
  right: 40.5%;
  border-radius: 50%;
  background: #27354A;
  z-index: 5;
}

.nose{
  position: absolute;
  background: #BE845F;
  width: 13%;
  height: 30.5%;
  left: 43.5%;
  top: 45%;
  border-radius: 50px;
  z-index: 5;
}

.hair-left{
  position: absolute;
  top: 12%;
  left: 39%;
  width: 10%;
	height: 12%;
	background:  #A6BECF;
	-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.hair-right{
  position: absolute;
  top: 14%;
  left: 50%;
  width: 10%;
	height: 12%;
	background:  #A6BECF;
	-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

@media all and (max-width: 600px) {
  .box{
    position: relative;
    margin: auto;
    display: block;
    margin-top: 2%;
    width: 400px;
    height: 280px;
    background: none;

  }
}
            
          
!
            
              //village
class Koala extends React.Component {
  render() {
    return (
      <Box colors={this.props.colors}/>
    )
  }
}

//neighborhood
class Box extends React.Component {
  render() {
    return (
     <div className="box">
       <EarLeft colors={this.props.colors}/>
       <EarRight colors={this.props.colors}/>
       <EyeLeft colors={this.props.colors}/>
       <EyeRight colors={this.props.colors}/>
       <Head color={this.props.colors.lightGray}/>
       <Nose color={this.props.colors.brown}/>
       <HairLeft color={this.props.colors.lightGray}/>
       <HairRight color={this.props.colors.lightGray}/>
     </div>
    )
  }
}

//blocks
class EarLeft extends React.Component {
  render() {
    return (
      <div>
        <OuterEarLeft color={this.props.colors.lightGray}/>
        <InnerEarLeft color={this.props.colors.darkGray}/>
      </div>
    )
  }
}

class EarRight extends React.Component {
  render() {
    return (
      <div>
        <OuterEarRight color={this.props.colors.lightGray}/>
        <InnerEarRight color={this.props.colors.darkGray}/>
      </div>
    )
  }
}

class EyeLeft extends React.Component {
  render() {
    return (
      <div>
        <OuterEyeLeft color={this.props.colors.white}/>
        <PupilLeft color={this.props.colors.navy}/>
      </div>
    )
  }
}
class EyeRight extends React.Component {
  render() {
    return (
      <div>
        <OuterEyeRight color={this.props.colors.white}/>
        <PupilRight color={this.props.colors.navy}/>
      </div>
    )
  }
}

//houses
class Head extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="head"></div>
    )
  }
}

class Nose extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="nose"></div>
    )
  }
}

class HairLeft extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="hair-left"></div>
    )
  }
}

class HairRight extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="hair-right"></div>
    )
  }
}

class OuterEarRight extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="outer-ear-right"></div>
    )
  }
}

class InnerEarRight extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="inner-ear-right"></div>
    )
  }
}

class OuterEarLeft extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="outer-ear-left"></div>
    )
  }
}

class InnerEarLeft extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="inner-ear-left"></div>
    )
  }
}

class OuterEyeLeft extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="outer-eye-left"></div>
    )
  }
}

class PupilLeft extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="pupil-left"></div>
    )
  }
}

class OuterEyeRight extends React.Component {
  render() {
    return (
      <div style={{background: this.props.color}} className="outer-eye-right"></div>
    )
  }
}

class PupilRight extends React.Component {
  render() {
    return (
      <div  style={{background: this.props.color}} className="pupil-right"></div>
    )
  }
}

//props objects
const colorsObject = {white: "#FFFFFF", lightGray: "#A6BECF", darkGray: "#819CAF", brown: "#BE845F", navy: "#27354A"}

//"inject" to DOM
ReactDOM.render(
  <Koala colors={colorsObject}/>,
  document.getElementById('koala')
);
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console