DEV Community

I Created My Portfolio with React and Some Magic 🎉

Dinesh Pandiyan on April 01, 2018

TL;DR - I re-wrote my portfolio in React and added some niche tricks to make it look all shiny and rad. Everytime you refresh the page, a new loo...
Collapse
 
dance2die profile image
Sung M. Kim

Wow great article and the site! 🎉

I have a feeling that you will be updating the ThemeSwitcher to use the new React.JS 16.3 API (reactjs.org/blog/2018/03/29/react-...)? 😜

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

React 16.3 was released 2 days after I created the theme switcher. I should've waited. Nevertheless I'm gonna re-write it with the new Context API sometime soon.

Collapse
 
dance2die profile image
Sung M. Kim

React 16.3 was released 2 days after I created the theme switcher
Ouch 😞...

I should've waited.
Nope. Just ship it 😀

I am learning a lot from your code and would love to see the update~

Collapse
 
thomasvaeth profile image
Thomas Vaeth

Have you looked at CSS variables? It seems a lot easier and a lot less work to ditch React and just use a couple of different data-themes.

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

We can do the same with Sass variables as well. But I want to be able to switch themes on user click. If we could achieve it with CSS variables, then it's time to ditch React's context API.

Collapse
 
thomasvaeth profile image
Thomas Vaeth • Edited

twitter.com/Real_CSS_Tricks/status... I was saying CSS variables that way you can just redefine them in the data-theme styling and cut down on have to write more CSS than necessary.

You could write some simple JS to just toggle the data-theme on body when the user clicks the color switch and that's all you would need instead of all of React.

Thread Thread
 
flexdinesh profile image
Dinesh Pandiyan

Wow! This is excellent. Thanks for bringing it up. I'm gonna take a deeper look into it. 🎉

Collapse
 
aurelkurtula profile image
aurel kurtula

I like it!

The first thing I thought of was "Users shouldn't be allowed to scroll"

Try it yourself

body {
  overflow: hidden;
}

That's just me thinking out loud

Great job

Collapse
 
defman profile image
Sergey Kislyakov

Users always should be allowed to scroll. Please stop messing around with scrolling.

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

Thanks Aurel! This is an interesting idea. But the portfolio page overflows the view height and the users might have to scroll there.

Collapse
 
aurelkurtula profile image
aurel kurtula

Cool. Din't think of that, it was just an immediate reaction.

Collapse
 
booligoosh profile image
Ethan

I love the cool idea of different themes! 😍

However, I feel like React is just overused for everything these days. Couldn't you have just applied CSS based on different classes for the

and then changed it with a few lines of JavaScript??
Collapse
 
flexdinesh profile image
Dinesh Pandiyan • Edited

If we went through different css classes approach, then everytime we add or remove a new theme, then we would need to make changes through the entire codebase and chances are we could easily miss a few spots and wouldn't notice it at all until someone points it out. This seemed like the easier way to theme it.

Collapse
 
aravindballa profile image
Aravind Balla

We can use css variables to theme things.

codepen.io/aravindballa/pen/XEpZbr

It is not supported in IE11 though!

Collapse
 
mohkhalifeh profile image
mohkhalifeh

Dude this is so cool.
I hope that one day i'd be able to create such things.
Keep it up 👍

Collapse
 
tonyfsullivan profile image
Tony Sullivan

Very cool site, Dinesh! Hope you don't mind, I was really impressed with your design when I saw it a couple weeks ago and got curious to see how the React code would translate to Svelte.

I just pushed an initial build to github.com/tonyfsullivan/tonyfsull...

I plan to rework the site to make it my own soon (I blatantly copied your styles and themes for the sake of a comparison), but it was interesting to see how to solve some of the complex designs (especially the background and scrolling) in a different framework!

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

Hey - I love the site and I also see you've tweaked the font as well. It looks great.

I'm glad you like my work and translated to code to a different framework without any glitches. I don't mind at all. The way I see it, it's not copy if you're inspired. Keep up the good work mate!

Collapse
 
erebos-manannan profile image
Erebos Manannán

Just as a quick note: I'm not a huge fan of people using just plain divs etc. for clickable things, as the browser does not know it's supposed to be basically a button.

For example in this case I have a Google translate extension installed. Combine that with the fact that when I click on text a few times it selects it, and then we have a prompt for the plugin showing up when I click on "Color me" a few times.

This could be avoided by using elements meant for the purpose and restyling them.

Collapse
 
kjir profile image
Stéphane Bisinger

I'm sorry to say that seeing this kind of killed my excitement:

Magic background is disabled in FireFox. Try in Chrome!

I've seen too many "Works only in Internet Explorer" websites back in the day to be able to accept a "Works best in Chrome" banners today. I don't know if you've experienced those days, but trust me when I say that we don't want to go back to the single browser experience.

I find it kind of ironic that you won't use CSS Grid because it's not supported by all browsers, but then add a disclaimer on non-Chrome browsers!

I encourage you to make the experience awesome regardless of the browser of choice: this way you'll better advertise your skills for a true cross-browser experience and you will respect your user's preferences.

Help us keep the web an open platform!

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

Stephane - I totally get your thoughts and stand by "true cross-browser experience" dev mindset. But at the same time, new specs come out everyday and browsers adopt them at different pace. I wanted to use this site as an opportunity to pick up on all the skills (including browser specific design). That's the only reason I put out that banner there. There's still a few things I need to figure out in animations and smooth scroll. Once I get those things figured out, I'm gonna take these banners away.

Maybe I'll just put a browser specific banner that says "Hey, you're using FireFox. You're awesome!"

That should work I guess. Thanks for taking your time and sharing your thoughts. Cheers! 🎉

Collapse
 
kjir profile image
Stéphane Bisinger

Hi Dinesh,
that is totally fair and it's cool that you try out new things as they come out: only make sure these do not hinder the experience in other browsers. Maybe if the banner wasn't there at all it would have gone unnoticed and people would feel more welcome even with other browsers!

Thank you for being open to the criticism :)

Collapse
 
outthislife profile image
Talasan Nicholson

"support for CSS Grid "

caniuse.com/#feat=css-grid

Collapse
 
katiethekoder profile image
KatietheKoder

You've created a great site! I'm going to use you for Inspo if that's okay! :)

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

Thanks Katie! Use it however you'd like to :)

Collapse
 
ethan profile image
Ethan Stewart

I'm curious, what browsers do you think are still lacking support for grid? I know IE11 has an old version of the spec, so if you have to support it then you have to account for that, but every other major browser has it now. Great article!

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

Ethan - IE11 is still officially supported by Microsoft and the grid spec doesn't work exactly well in IE11. So that's why I put it out. But re-thinking it now, I should start picking up on my grid skills soon.

Collapse
 
sanbeaman profile image
sanbeaman

Great Article!
What is your build and deploy process?
I know that the "master" branch has to contain the compiled files in order for user.github.io pages to work, and I see you have a "dev" branch that contains your source files.

Looking at your package.json
"deploy": "aws s3 cp build/ s3://dineshpandiyan.com --recursive"

How are you building the files and moving just the contents of the "build" folder from the "dev" branch to the "master" branch? via webhooks?

thanks,
drew

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

Hey, I use gh-pages library for that.

Previously my code was
"deploy": "gh-pages -d build -b master"

I recently changed it to
"deploy": "aws s3 cp build/ s3://dineshpandiyan.com --recursive"

because I bought a new domain - dineshpandiyan.com. I haven't acted on it because I'm yet to setup https in it.

gh-pages pretty much takes care of everything. But it will also delete all your source code in master branch. That's why my source code is in dev branch.

Collapse
 
rifaimartin profile image
Rifai Martin

is there a github link?

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

It's mentioned in the post. Here it is - GitHub link

Collapse
 
rifaimartin profile image
Rifai Martin

does this use npm start to run it?

Thread Thread
 
flexdinesh profile image
Dinesh Pandiyan

Yes. But remember, the source code is in dev branch.

You will need to run git checkout -b dev origin/dev first.

Then

npm install

npm start

Collapse
 
tylerlangties profile image
Tyler Langties • Edited

Looks great. What did you use to be able to use @ to access files outside of the current directory? I’ve always just used ../ to exit and then go back into the file.

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

I used webpack alias to configure alias name to directories. It's easy that way.

You can refer this line for more info.
github.com/flexdinesh/flexdinesh.g...

Collapse
 
tylerlangties profile image
Tyler Langties

Sweet! Thank you for the quick reply

Collapse
 
tomheadle profile image
TomHeadle

Very fun. I am going to play with what you did and make a react version of my portfolio!

Collapse
 
andrescampuzano profile image
Andres Campuzano Garzon

Great article.

Collapse
 
nihalmurmu profile image
Nihal Murmu

Quite neat, I deployed a react app in github user page, but for a wrong URL or opening a github project page it's still showing me the github user page, any tips and tricks for me ?

Collapse
 
rehas profile image
berat reha sönmez

Simple yet elegant!

I am also planning to create a simple portfolio this will definitely be an inspiration.

Well done!

Collapse
 
lkreimann profile image
Lea Reimann 🦄

Looks awesome! Sad that the "magic background" doesn't work in Firefox :(

Collapse
 
flexdinesh profile image
Dinesh Pandiyan

Hey - I'm working on revising the parallax. This time I'll make sure it works great in all browsers :)

Collapse
 
carlossz profile image
Charles S.

Great job Dinesh!

Collapse
 
madhu profile image
madhu

I created my portfolio as well => madhusudhan-srinivas.github.io/

Collapse
 
numbiceman profile image
PK

Hey Dinesh, nice article and site. Do perhaps have a tutorial or step by step procedure how to make a similar portfolio? Thanks!

Collapse
 
jess profile image
Jess Lee • Edited

@aspittel not sure if you ever saw this shout out!