Skip to content

Instantly share code, notes, and snippets.

@productioncoder
productioncoder / install-create-react-app.sh
Created August 30, 2018 11:56
Install create-react-app
npm i -g create-react-app
@productioncoder
productioncoder / start-app.sh
Created August 31, 2018 08:42
Starting the application
# you can also run npm start instead
yarn start
@productioncoder
productioncoder / commit-project-setup
Created August 31, 2018 09:57
Commit Project Setup
git add -A
git commit -m "project setup"
git push
@productioncoder
productioncoder / install-semantic-ui.sh
Created August 31, 2018 13:34
Installing Semantic UI in React
yarn add semantic-ui-react semantic-ui-css
@productioncoder
productioncoder / index.js
Created August 31, 2018 13:44
Import Semantic UI CSS
import 'semantic-ui-css/semantic.min.css';
// ...
@productioncoder
productioncoder / package.json
Created August 31, 2018 14:19
Update package.json to support SCSS
"scripts": {
"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build-js": "react-scripts build",
"build": "npm-run-all build-css build-js",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
@productioncoder
productioncoder / HeaderNav.js
Last active September 1, 2018 13:01
Adding an input element to HeaderNav
<Menu borderless className='top-menu' fixed='top'>
<Menu.Item header className='logo'>
<Image src={logo} size='tiny'/>
</Menu.Item>
<Menu.Menu className='nav-container'>
<Menu.Item className='search-input'>
<Form>
<Form.Field>
<Input placeholder='Search'
size='small'
@productioncoder
productioncoder / HeaderNav.js
Created September 1, 2018 13:07
HeaderNav icons
<Menu.Menu position='right'>
<Menu.Item>
<Icon className='header-icon' name='video camera' size='large'/>
</Menu.Item>
<Menu.Item>
<Icon className='header-icon' name='grid layout' size='large'/>
</Menu.Item>
<Menu.Item>
<Icon className='header-icon' name='chat' size='large'/>
</Menu.Item>
@productioncoder
productioncoder / App.js
Created September 1, 2018 13:16
App.js HeaderNav demo
import React, { Component } from 'react';
import HeaderNav from './containers/HeaderNav/HeaderNav';
class App extends Component {
render() {
return (
<HeaderNav/>
);
}
}
@productioncoder
productioncoder / SideBar.scss
Last active September 2, 2018 16:10
Styling Semantic UI's fixed sidebar
.ui.menu.fixed.side-nav {
background-color: #f5f5f5;
margin-top: 64px;
overflow-y: auto;
padding-bottom: 64px;
.sidebar-item:hover {
background: #ebebeb;
}
}