Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icon for each topic #17

Merged
merged 1 commit into from Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 47 additions & 2 deletions src/components/TopicVoter.tsx
Expand Up @@ -3,15 +3,60 @@ import { jsx, css } from '@emotion/core';
import React from 'react';
import { mediaMaxWidth } from '../util';

export default (props: { name: string, color: string}) => {
export default (props: { name: string, color: string }) => {
let logo;

switch (props.name) {
case "การศึกษา": {
logo = require("./img/education.png");
break;
}
case "เศรษฐกิจ": {
logo = require("./img/economic.png");
break;
}
case "การเกษตร": {
logo = require("./img/agriculture.png");
break;
}
case "สาธารณสุข": {
logo = require("./img/medical.png");
break;
}
case "คมนาคม": {
logo = require("./img/transportation.png");
break;
}
case "เทคโนโลยี": {
logo = require("./img/technology.png");
break;
}
case "สิ่งแวดล้อม": {
logo = require("./img/environment.png");
break;
}
case "ความมั่นคง": {
logo = require("./img/security.png");
break;
}
case "ยุติธรรม": {
logo = require("./img/justice.png");
break;
}
default: {
logo = require("./img/default.png");
break;
}
}
return (
<div css={{ width: '120px', textAlign: 'center'}}>
<div css={{ width: '120px', textAlign: 'center' }}>
<div css={{
[mediaMaxWidth(768)]: { fontSize: '0.8em' }
}}>
{props.name}
</div>
<div css={{ minHeight: '300px', margin: '10px 0', background: props.color || 'white' }}></div>
<div><img src={logo} alt={props.name} css={{ width: '80px', height: '80px' }}></img></div>
</div>
);
}
Binary file added src/components/img/agriculture.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/economic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/education.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/environment.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/justice.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/medical.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/security.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/technology.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/img/transportation.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/pages/MainPage.tsx
Expand Up @@ -5,19 +5,19 @@ import TopicVoter from '../components/TopicVoter';
import { Link } from "react-router-dom";

export default () => {
return (<div css={{ margin: '15vh 100px 100px'}}>
<h1 css={{ margin: '50px'}}>
return (<div css={{ margin: '15vh 100px 100px' }}>
<h1 css={{ margin: '50px' }}>
<span css={{ fontSize: '2.5em' }}>
อยากให้
</span>
<span css={{ margin: '0 30px', fontSize: '4.5em'}}>
<span css={{ margin: '0 30px', fontSize: '4.5em' }}>
ภาษี
</span>
<span css={{ fontSize: '2.5em' }}>
ไปไหน?
</span>
</h1>
<div css={{display: 'flex', justifyContent: 'space-between'}}>
<div css={{ display: 'flex', justifyContent: 'space-between' }}>
{topic.map(item => {
return (<TopicVoter name={item.name} color={item.color} />);
})}
Expand Down