cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              @import 'https://fonts.googleapis.com/css?family=Antic+Didone|Montserrat:700';


$white: #fff;

:root {
	margin: 0;
	padding: 0;
	font: {
		family: 'Antic Didone';
		size: 13px;
	}
}
@media screen and (min-width: 760px) {
	:root {
		font-size: 15px;
	}
}
@media screen and (min-width: 820px) {
	:root {
		font-size: 16px;
	}
}
@media screen and (min-width: 900px) {
	:root {
		font-size: 17px;
	}
}
@media screen and (min-width: 980px) {
	:root {
		font-size: 18px;
	}
}
@media screen and (min-width: 1060px) {
	:root {
		font-size: 19px;
	}
}
@media screen and (min-width: 1220px) {
	:root {
		font-size: 20px;
	}
}
@media screen and (min-width: 1400px) {
	:root {
		font-size: 22px;
	}
}

html,
body, 
#app {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
}

#app {
	position: relative;
	animation: fadeIn 500ms ease-in-out forwards;
}

.selectors {
	position: absolute;
	top: 0;
	left: 0;
	width: 30px;
	background: rgba(0, 0, 0, 0.1);
	height: 100vh;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 1;
	.selector {
		border: 1px solid $white;
		background: none;
		width: 11px;
		height: 11px;
		border-radius: 50%;
		margin: 5px 0;
		opacity: 0.6;
		cursor: pointer;
		transition: background .3s ease-in-out, opacity .3s ease-in-out;
		&:hover,
		&.active {
			background: white;
			opacity: 0.9;
		}
	}
}

section.wrapper {
	width: 100%;
	height: 100%;
	background-size: cover;
	transition: background-image 500ms ease-in-out;
}

aside.panel {
	width: 40vw;
	height: 100%;
	opacity: 0.9;
	color: $white;
	box-shadow: 5px 0 25px 0 rgba(0, 0, 0, 0.3);
	transition: background 500ms ease-in-out;
	h2.panel-header,
	p.panel-info {
		margin: 0;
		padding: 1.3rem 3.5rem;
	}
	h2.panel-header {
		padding-top: 2em;
		font: {
			weight: normal;
			size: 2.5rem;
		}
		text-transform: capitalize;
	}
	p.panel-info {
		font: {
			size: 1.2rem;
		}
		line-height: 1.8em;
	}
	button.panel-button {
		margin: 1.3rem 3.5rem;
		padding: 0.8em 1.3em;
		background: none;
		border: 1px solid $white;
		color: $white;
		cursor: pointer;
		font: {
			family: 'Montserrat';
			size: 0.8rem;
			weight: 700;
		}
		text-transform: uppercase;
		transition: box-shadow 0.5s ease-in-out, color 0.5s ease-in-out;
		&:hover {
			box-shadow: inset 0 0 1.5em 1.5em $white;
		}
		&:focus {
			outline: none;
		}
	}
}

@keyframes fadeIn {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}
            
          
!
            
              class App extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			activeID: 0,
			wrapperStyle: {
				backgroundImage: `url('${this.props.data[0].img}')`
			},
			panelStyle: {
				background: this.props.data[0].colour
			},
			buttonHover: false,
			buttonStyle: {
				color: '#ffffff'
			}
		};
	}
	_changeActive(id) {
		this.setState({
			activeID: id,
			wrapperStyle: {
				backgroundImage: `url('${this.props.data[id].img}')`
			},
			panelStyle: {
				backgroundColor: this.props.data[id].colour
			}
		});
	}
	_buttonColour() {
		if(!this.state.buttonHover){
			this.setState({
				buttonHover: true,
				buttonStyle: {
					color: this.props.data[this.state.activeID].colour
				}
			});
		} else {
			this.setState({
				buttonHover: false,
				buttonStyle: {
					color: '#ffffff'
				}
			});
		}
	}
	render() {
		return (
			<section className="wrapper" style={this.state.wrapperStyle}>
				<Selectors 
					data={this.props.data}
					activeID={this.state.activeID}
					_changeActive={this._changeActive.bind(this)}
				/>
				<Panel 
					data={this.props.data[this.state.activeID]}
					panelStyle={this.state.panelStyle}
					buttonStyle={this.state.buttonStyle}
					_buttonColour={this._buttonColour.bind(this)}
				/>
			</section>
		);
	}
}
class Panel extends React.Component {
	render() {
		return (
			<aside className="panel" style={this.props.panelStyle}>
				<h2 className="panel-header">{this.props.data.header}</h2>
				<p className="panel-info">{this.props.data.body}</p>
				<button className="panel-button" 
					style={this.props.buttonStyle}
					onMouseEnter={this.props._buttonColour}
					onMouseLeave={this.props._buttonColour}>
					Read More
				</button>
			</aside>
		);
	}
}
class Selectors extends React.Component {
	_handleClick(e) {
		if (this.props.id !== this.props.activeID) {
			this.props._changeActive(this.props.id);
		} else {
			return;
		}
	}
	render() {
		return (
			<div className="selectors">
				{this.props.data.map((item) => 
					<Selector 
						key={item.id}
						id={item.id}
						_handleClick={this._handleClick}
						_changeActive={this.props._changeActive}
						activeID={this.props.activeID}
					/>
				)}
			</div>
		);
	}
}
class Selector extends React.Component {
	render() {
		let componentClass = 'selector';
		if (this.props.activeID === this.props.id) {
			componentClass = 'selector active';
		}
		return (
			<div className={componentClass} onClick={this.props._handleClick.bind(this)}></div>
		);
	}
}

const data = [{
	id: 0,
	header: 'Gluten-free Bicycle',
	body: 'Chillwave knausgaard chambray flannel tumblr, narwhal microdosing blog...',
	colour: '#242846',
	img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/735173/rvc1.jpg'
}, {
	id: 1,
	header: 'Post-ironic Disrupt',
	body: 'Swag biodiesel disrupt retro fashion, salvia food truck kitsch wolf DIY...',
	colour: '#ba9077',
	img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/735173/rvc2.jpg'
}, {
	id: 2,
	header: 'Lumber-Sexual Roof Party ',
	body: 'Flexitarian 3 wolf moon cliche, migas scenester street art...',
	colour: '#1ABC9C',
	img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/735173/rvc3.jpg'
}, {
	id: 3,
	header: 'Vegan hoodie trust fund',
	body: 'Farm-to-table tousled try-hard, normcore ethical tilde iPhone...',
	colour: '#C0392B',
	img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/735173/rvc4.jpg'
}, {
	id: 4,
	header: 'cliche craft beer',
	body: 'Tote bag flannel normcore polaroid +1. Quinoa actually 90s sustainable...',
	colour: '#513B56',
	img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/735173/rvc5.jpg'
}];


ReactDOM.render(<App data={data} />, document.querySelector('#app'));
            
          
!
999px
Loading ..................

Console