Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="app"></div>

<footer>
	<p>
		Created with <i class="fa fa-heart"></i> by
		<a target="_blank" href="https://fredsiika.io">Fred Siika</a>
		- Read about what I do on my
		<a target="_blank" href="https://fredsiika.github.io/fredcodes">Website</a>
	</p>
</footer>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Lato');

/* Global */
:root {
	font-size: calc(1vw + 1vh + .5vmin); 
}

* {
	box-sizing: border-box;
}

body {
	background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
	
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;

	min-height: 100vh;
	font-family: 'Lato', sans-serif;
	margin: 0;
}

h1 {
	text-align: center;
}

/* Default links */
a[href]:not([class]) {
  color: #ffc6ff;
  text-decoration: none;
}

#app {
	padding: 0 1.25em;
	width: 100%;
}

/* ===== Header ==== */
/* Intrinsic Ratio Boxes - Using 20% for padding makes the height of the box equal to 20% of its width. No matter the width of the viewport, the child div will keep its aspect ratio (100% / 20% = 5:1). Source: https://github.com/AllThingsSmitty/css-protips#intrinsic-ratio-boxes */

.header-container {
	height: 0;
	padding-bottom: 20%;
	position: relative;
	margin: 20px 0;
}

.header-item {
	background: linear-gradient(45deg, #2989d8, 0%, #7db9e8 100%);
	height: 100%;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
}

.header-item-content {
}

.header-item-content .author {
	color: #fff;
    font-size: 12px;
    font-weight: bold;
    top: -10px;
    left: 5px;
    letter-spacing: 1px;
    padding: 5px;
    position: absolute;
    text-transform: uppercase;
}

.header-item-content .sub {
	font-weight: bold;
	color: #fff;
	font-size: 12px;
    line-height: 1.6;
	position: absolute;
	bottom: -20px;
	left: 5px;
	letter-spacing: 1px;
	padding: 10px;
	text-transform: uppercase;
}

.header-item-content .social {
	color: #fff;
    font-size: 12px;
    font-weight: bold;
    top: -10px;
    right: 5px;
    letter-spacing: 1px;
    padding: 5px;
    position: absolute;
    text-transform: uppercase;
}

nav {
	background-color: #384150;
	padding: 2em;
	text-align: center;
	position: relative;
	height: 80px;
}

nav ul {
	padding: 0;
}

nav li {
	display: inline-block;
	font-size: 1em;
	padding: 0.25em 1em;
	text-transform: uppercase;
}

nav li:not(:last-child) {
	border-right: 1px solid #fff;
}

nav a {
  color: #ccc;
  text-decoration: none;
}

nav a:hover {
  border-bottom: 1px solid #16db93;
}

/* Timeline */
.timeline-container {
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 40px 0;
}

.timeline-container::after {
    background-color: #e17b77;
    content: '';
    position: absolute;
    left: calc(50% - 2px);
    width: 4px;
    height: 100%;
}

.timeline-item {
    display: flex;
    justify-content: flex-end;
    padding-right: 30px;
    position: relative;
    margin: 10px 0;
    width: 50%;
}

.timeline-item:nth-child(odd) {
    align-self: flex-end;
    justify-content: flex-start;
    padding-left: 30px;
    padding-right: 0;
}

.timeline-item-content {
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 15px;
    position: relative;
    width: 400px;
    max-width: 100%;
    text-align: right;
}

.timeline-item-content::after {
    content: ' ';
    background-color: #fff;
    box-shadow: 1px -1px 1px rgba(0, 0, 0, 0.2);
    position: absolute;
    right: -7.5px;
    top: calc(50% - 7.5px);
    transform: rotate(45deg);
    width: 15px;
    height: 15px;
}

.timeline-item:nth-child(odd) .timeline-item-content {
    text-align: left;
    align-items: flex-start;
}

.timeline-item:nth-child(odd) .timeline-item-content::after {
    right: auto;
    left: -7.5px;
    box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.2);
}

.timeline-item-content .tag {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    top: 5px;
    left: 5px;
    letter-spacing: 1px;
    padding: 5px;
    position: absolute;
    text-transform: uppercase;
}

.timeline-item:nth-child(odd) .timeline-item-content .tag {
    left: auto;
    right: 5px;
}

.timeline-item-content time {
    color: #777;
    font-size: 12px;
    font-weight: bold;
}

.timeline-item-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0.95em 0;
    max-width: 250px;
}

.timeline-item-content a {
	color: #333;
	text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.timeline-item-content a::after {
    content: ' ►';
    font-size: 12px;
}

.timeline-item-content .circle {
    background-color: #fff;
    border: 3px solid #e17b77;
    border-radius: 50%;
    position: absolute;
    top: calc(50% - 10px);
    right: -40px;
    width: 20px;
    height: 20px;
    z-index: 100;
}

.timeline-item:nth-child(odd) .timeline-item-content .circle {
    right: auto;
    left: -40px;
}

@media only screen and (max-width: 1023px) {
    .timeline-item-content {
        max-width: 100%;
    }
}

@media only screen and (max-width: 767px) {
    .timeline-item-content,
    .timeline-item:nth-child(odd) .timeline-item-content {
        padding: 15px 10px;
        text-align: center;
        align-items: center;
    }

    .timeline-item-content .tag {
        width: calc(100% - 10px);
        text-align: center;
    }

    .timeline-item-content time {
        margin-top: 20px;
    }

    .timeline-item-content a {
        text-decoration: underline;
    }

    .timeline-item-content a::after {
        display: none;
    }
}

footer {
    background-color: #222;
    color: #fff;
    font-size: 14px;
    bottom: 0;
    position: fixed;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 999;
}

footer p {
    margin: 10px 0;
}

footer i {
    color: red;
}

footer a {
    color: #3c97bf;
    text-decoration: none;
}
              
            
!

JS

              
                const timelineData = [
    {
        text: 'Started working on the app-ideas repository',
        date: 'February 25 2019',
        category: {
			tag: 'app-ideas',
			color: '#FFDB14'
		},
        link: {
            url: '#!',
            text: 'Check it out on GitHub'
        }
    },
    {
        text: 'Started the Weekly Coding Challenge program',
        date: 'March 04 2019',
        category: {
			tag: 'blog',
			color: '#e17b77'
		},
        link: {
            url: '#!',
            text: 'Check it out here'
        }
    },
    {
        text: 'Got 1.000 followers on Twitter',
        date: 'March 07 2019',
        category: {
			tag: 'twitter',
			color: '#1DA1F2'
		},
        link: {
            url: '#!',
            text: 'See profile'
        }
    },
    {
        text:
            'I published my first article in the FreeCodeCamp Medium Publication',
        date: 'March 18 2019',
        category: {
			tag: 'medium',
			color: '#018f69'
		},
        link: {
            url:
                '#!',
            text: 'Check it out here'
        }
    },
    {
        text: 'Over 12.000 views in a single day on my Medium posts',
        date: 'April 05 2019',
        category: {
			tag: 'medium',
			color: '#018f69'
		},
        link: {
            url: '#!',
            text: 'See profile'
        }
    }
]

const headerData = [
	{
		heading: 'React Timeline',
		subheading: 'Made with React.',
		author: 'Fred Siika',
		date: 'July 20 2020',
		category: {
			tag: 'Codepen',
			color: 'white',
			background: 'linear-gradient(45deg, #2989d8 0%, #7db9e8 100%);'
		},
		link: {
			url: 'https://codepen.io/fredsiika1/pen/EJvWBZ',
			text: `See more from Fred.`
		},
		social: {
			github: {
				name: 'GitHub',
				url: 'https://github.com/fredsiika',
			},
			codepen: {
				name: 'Codepen',
				url: 'https://codepen.io/fredsiika1'
			},
			linkedIn: {
				name: 'LinkedIn', 
				url: 'https://linkedin.com/in/fredsiika',
			},
			instagram: {
				name: 'Instagram', 
				url: 'https://instagram.com/fredsiika',
			},
			twitter: {
				name: 'Twitter',
				url: 'https://twitter.com/fredsiika',
			},
		}
	}
]

const TimelineItem = ({ data }) => (
    <div className="timeline-item">
        <div className="timeline-item-content">
            <span className="tag" style={{ background: data.category.color }}>
                {data.category.tag}
            </span>
            <time>{data.date}</time>
            <p>{data.text}</p>
            {data.link && (
                <a
                    href={data.link.url}
                    target="_blank"
                    rel="noopener noreferrer"
                >
                    {data.link.text}
                </a>
            )}
            <span className="circle" />
        </div>
    </div>
);

const Timeline = () =>
    timelineData.length > 0 && (
        <div className="timeline-container">
            {timelineData.map((data, idx) => (
                <TimelineItem data={data} key={idx} />
            ))}
        </div>
    );

const HeaderItem = ({ data }) => (
	<div className="header-item">
		<div className="header-item-content">
			<nav>
				
				<p className="author" style={{ color: data.category.color}}>{data.author}</p>
			
				<ul class="social">
				<li>{data.link && (
				<a href={data.social.instagram.url}
					target="_blank"
					rel="noopener noreferrer">
					{data.social.instagram.name}
				</a>
			)}</li>
				<li>{data.link && (
				<a href={data.social.github.url}
					target="_blank"
					rel="noopener noreferrer">
					{data.social.github.name}
				</a>
					)}</li>
				<li>{data.link && (
				<a href={data.social.codepen.url}
					target="_blank"
					rel="noopener noreferrer">
					{data.social.codepen.name}
				</a>
					)}</li>
			</ul>
			</nav>
			<h1>{data.heading}</h1>
			<p className="sub">{data.subheading}</p>
		</div>
		
	</div>
);

const Header = () => headerData.length > 0 && (
	<div className="header-container">
		{headerData.map((data, idx) => (
			<HeaderItem data={data} key={idx} />
		))}
	</div>
);

const App = () => <>
	<Header />
	<Timeline />
</>;

ReactDOM.render(<App />, document.getElementById('app'));
              
            
!
999px

Console