Skip to content

Commit

Permalink
Merge branch 'release/0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
hyldmo committed Feb 2, 2018
2 parents 85cea97 + 0865083 commit 4bacd52
Show file tree
Hide file tree
Showing 16 changed files with 604 additions and 60 deletions.
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "emoji-keyboard",
"version": "0.4.2",
"version": "0.5.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server --config webpack.development.config.js --progress --colors",
"prod": "webpack --config webpack.production.config.js --progress --colors",
"dev": "webpack-dev-server --config webpack.development.config.js --progress --colors --define process.env.NODE_ENV='development'",
"prod": "webpack --config webpack.production.config.js --colors --define process.env.NODE_ENV='production'",
"lint": "tslint *.{ts,tsx}",
"test": "echo \"Warning: no test specified\""
},
Expand All @@ -14,15 +14,19 @@
"test"
],
"author": "eivindh",
"repository": {
"type": "git",
"url": "https://github.com/eivhyl/emoji-keyboard.git"
},
"license": "MIT",
"dependencies": {
"@types/copy-text-to-clipboard": "^1.0.0",
"copy-text-to-clipboard": "^1.0.4",
"normalize.css": "^7.0.0",
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"devDependencies": {
"@types/copy-text-to-clipboard": "^1.0.0",
"@types/node": "^8.0.0",
"@types/react": "^16.0.35",
"@types/react-dom": "^16.0.3",
Expand All @@ -33,9 +37,11 @@
"html-webpack-plugin": "2.30.1",
"pre-commit": "^1.2.2",
"react-hot-loader": "^4.0.0-beta.18",
"react-svg-loader": "^2.1.0",
"style-loader": "^0.20.1",
"tslint": "^5.6.0",
"typescript": "^2.6.2",
"uglifyjs-webpack-plugin": "^1.1.8",
"webpack": "^3.10.0",
"webpack-dev-server": "2.11.1"
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class App extends React.Component<{}, State> {
.map(e => e.category)
.filter((value, index, self) => self.indexOf(value) === index)
return (
<div id="app">
<>
<main>
<h1 className="title">Emoji Keyboard <small>(Click to copy)</small></h1>
<div>
Expand Down Expand Up @@ -95,7 +95,7 @@ class App extends React.Component<{}, State> {
))}
</main>
<Footer/>
</div>
</>
)
}
}
Expand Down
25 changes: 7 additions & 18 deletions src/components/Emoji.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { Emoji } from '../types'
import Tooltip from './Tooltip'

import '../styles/emoji.css'

Expand Down Expand Up @@ -29,24 +30,12 @@ class EmojiButton extends React.Component<Props, State> {
{emoji.emoji}
</button>
{hover && (
<ul className="tooltip">
<li>
<strong>Category: </strong><span>{emoji.category}</span>
</li>
<li>
<strong>Description: </strong><span>{emoji.description}</span>
</li>
{emoji.aliases.length > 0 &&
<li>
<strong>Also known as: </strong><span>{emoji.aliases.join(', ')}</span>
</li>
}
{emoji.tags.length > 0 &&
<li>
<strong>Tags: </strong><span>{emoji.tags.join(', ')}</span>
</li>
}
</ul>
<Tooltip values={[
['Description', emoji.description],
['Category', emoji.category],
['Also known as', emoji.aliases.join(', '), emoji.aliases.length > 0],
['Tags', emoji.tags.join(', '), emoji.tags.length > 0]
]} />
)}
</div>
)
Expand Down
5 changes: 5 additions & 0 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import * as React from 'react'

const GitHub = require('../../static/GitHub-Mark.svg').default as React.ComponentClass<React.SVGProps<SVGSVGElement>>

const Navbar: React.StatelessComponent = (props) => (
<footer>
<span>{process.env.PACKAGE_NAME} v{process.env.PACKAGE_VERSION}</span>
<a href={process.env.REPO_URL}>
<GitHub width={32} height={32}/>
</a>
</footer>
)

Expand Down
24 changes: 24 additions & 0 deletions src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react'
import { Triple, Tuple } from '../types'

type Props = {
values: Array<Tuple<string, string> | Triple<string, string, boolean>>
}

const Tooltip: React.StatelessComponent<Props> = ({ values }) => (
<ul className="tooltip">
{values.map(triplet => triplet[2] !== false
? (
<li key={triplet[0]}>
<strong>{triplet[0]}: </strong>
<span>{triplet[1]}</span>
</li>
)
: (
null
)
)}
</ul>
)

export default Tooltip
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import './styles/site.css'

ReactDOM.render(
<App />,
document.getElementById('root')
document.getElementById('app')
)
2 changes: 1 addition & 1 deletion src/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ input {
flex-flow: row wrap;
}

@media (max-width: 800px) {
@media (max-width: 832px) {
.emojis:not(.favorites) {
justify-content: space-between;
}
Expand Down
3 changes: 1 addition & 2 deletions src/styles/emoji.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

.emoji:hover {
background-color:#D3D3D3;
background-color: gainsboro;
}

.emojicontainer {
Expand All @@ -26,5 +26,4 @@
background-color: white;
border: 2px solid gainsboro;
border-radius: 0.5rem;

}
10 changes: 7 additions & 3 deletions src/styles/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
box-sizing: border-box;
}

html, body, #root {
html, body {
font-family: sans-serif;
height: 100%;
background-color: var(--background);
Expand All @@ -15,6 +15,7 @@ html {

#app {
display: grid;
padding: 1rem;
width: 100%;
height: 100%;
grid-template-areas: "left main right"
Expand All @@ -24,10 +25,9 @@ html {
grid-template-columns: auto 800px auto;
}

@media (max-width: 800px) {
@media (max-width: 832px) {
#app {
grid-template-columns: 0 100% 0;
padding: 1rem;
}
}

Expand All @@ -36,6 +36,10 @@ main {
}

footer {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: space-between;
padding-top: 1rem;
grid-area: footer;
}
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ export type Favorite = Emoji & { used: number }
export type Save = {
favorites: { [key: number]: Favorite | undefined }
}

export type Tuple<T1, T2> = [T1, T2]
export type Triple<T1, T2, T3> = [T1, T2, T3]

4 changes: 4 additions & 0 deletions static/GitHub-Mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion templates/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="root"></div>
<div id="app"></div>
</body>
</html>
8 changes: 6 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ module.exports = {
loader: 'awesome-typescript-loader',
exclude: ['node_modules'],
},
{
test: /\.svg$/,
loaders: ['react-svg-loader']
}
],
},

Expand All @@ -40,9 +44,9 @@ module.exports = {
}),
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.PACKAGE_NAME': JSON.stringify(packageJSON.name),
'process.env.PACKAGE_VERSION': JSON.stringify(packageJSON.version)
'process.env.PACKAGE_VERSION': JSON.stringify(packageJSON.version),
'process.env.REPO_URL': JSON.stringify(packageJSON.repository.url)
}),
]
};
2 changes: 1 addition & 1 deletion webpack.development.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = Object.assign(CONFIG, {
publicPath: `http://localhost:${port}/`,
}),

devtool: 'eval-source-map',
devtool: 'inline-source-map',

devServer: {
historyApiFallback: true,
Expand Down
4 changes: 4 additions & 0 deletions webpack.production.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const CONFIG = require('./webpack.config');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

module.exports = Object.assign(CONFIG, {
devtool: 'source-map',
Expand Down Expand Up @@ -30,6 +31,9 @@ module.exports = Object.assign(CONFIG, {

plugins: [
new ExtractTextPlugin('styles.css'),
new UglifyJsPlugin({
sourceMap: true
}),
...CONFIG.plugins
]
});
Loading

0 comments on commit 4bacd52

Please sign in to comment.