Skip to content

Instantly share code, notes, and snippets.

View dhimasanb's full-sized avatar
🎯
Focusing

Dhimas Akbar Noor Baihaque dhimasanb

🎯
Focusing
View GitHub Profile
@dhimasanb
dhimasanb / index.js
Created June 25, 2019 16:40
Home index.js
import React, { Component } from "react";
import { Input, Button, Typography, Row, Col, message } from "antd";
import TableResult from "./components/TableResult";
import { validationAmount } from "../../utils/helpers";
import { fractions } from "../../config/fractions";
class Home extends Component {
state = {
amount: "",
amountLeft: null,
@dhimasanb
dhimasanb / app.js
Created June 25, 2019 16:43
Scene App.js
import React from "react";
import { Layout, Icon } from "antd";
import Home from "./Home";
import "./App.css";
const App = () => {
return (
<Layout className="app">
<Layout.Content>
<div className="box">
@dhimasanb
dhimasanb / helpers.js
Created June 25, 2019 16:47
Util helpers
// Check if there are ',' & '.' in a input and after ',' is not 00
function checkSeparator(amount) {
if (amount.indexOf(",") > -1 || amount.indexOf(" ") > -1) {
if (amount.split(",")[1] !== "00") {
throw new Error("Invalid separator!");
}
}
}
// Check Rp is wrong position
/* global describe, it, expect, beforeEach :true */
import React from "react";
import { shallow, configure } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import Home from "../scenes/Home";
configure({ adapter: new Adapter() });
describe("Home Scene", () => {
const wrapper = shallow(<Home />);