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

Development #4

Merged
merged 125 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
997dfd5
update height
aycanogut Jan 2, 2022
2ae1261
add images
aycanogut Jan 2, 2022
ee217db
create components
aycanogut Jan 2, 2022
fd99939
add data.json
aycanogut Jan 3, 2022
e2572af
update svg icon
aycanogut Jan 3, 2022
ea12656
update json imports
aycanogut Jan 3, 2022
25c1ce3
update object structure
aycanogut Jan 3, 2022
6aba565
add dummy children
aycanogut Jan 3, 2022
a1f59c2
update children
aycanogut Jan 3, 2022
886ded4
add height and max-width
aycanogut Jan 3, 2022
d2b13a9
update css module
aycanogut Jan 3, 2022
d369e8b
add styles
aycanogut Jan 3, 2022
a01c362
add screen
aycanogut Jan 3, 2022
c3c6072
add imports and elements
aycanogut Jan 3, 2022
f5fc5cf
update children
aycanogut Jan 3, 2022
83a91db
update type and children
aycanogut Jan 3, 2022
399e4c8
update spacing
aycanogut Jan 3, 2022
432fc29
add icon
aycanogut Jan 3, 2022
4597e26
add garbage icon data
aycanogut Jan 3, 2022
eceb022
create component
aycanogut Jan 3, 2022
127a1fc
update classname
aycanogut Jan 3, 2022
d0a7c2e
add history component
aycanogut Jan 3, 2022
5e3b9fe
update spacing
aycanogut Jan 3, 2022
4b119fd
update alingment and spacing
aycanogut Jan 4, 2022
cc7a11b
add styles
aycanogut Jan 4, 2022
0570eab
update spacing
aycanogut Jan 4, 2022
d99564b
add dummy nodes
aycanogut Jan 4, 2022
bb94ba0
add types and dom nodes
aycanogut Jan 4, 2022
31b762a
update spacing
aycanogut Jan 4, 2022
7ee5f8c
create component
aycanogut Jan 4, 2022
dfaebce
add calculator
aycanogut Jan 4, 2022
443207d
add header layout styling
aycanogut Jan 4, 2022
107db5c
add back icon
aycanogut Jan 4, 2022
a4e8015
update children
aycanogut Jan 4, 2022
8a2b911
add wrapper for story
aycanogut Jan 4, 2022
5d9e2da
add spacing and alignment
aycanogut Jan 4, 2022
699e024
add alignment, remoe spacing
aycanogut Jan 4, 2022
71f34ab
update classname
aycanogut Jan 4, 2022
1159e4a
update spacing
aycanogut Jan 4, 2022
ea5a888
add fixed height
aycanogut Jan 4, 2022
04e6eae
create stories
aycanogut Jan 4, 2022
8136d58
add story wrapper styles
aycanogut Jan 4, 2022
f724bb6
update import orders
aycanogut Jan 4, 2022
a3a3398
add pointer
aycanogut Jan 5, 2022
94fc83f
add onClick props
aycanogut Jan 5, 2022
e2d51b9
remove state
aycanogut Jan 5, 2022
69c0a93
add icon toggle functionality
aycanogut Jan 5, 2022
473b795
remove icon state method
aycanogut Jan 5, 2022
45a6047
create component
aycanogut Jan 5, 2022
3ccb90a
add header
aycanogut Jan 5, 2022
bd0d47a
remove icons
aycanogut Jan 5, 2022
5000128
add shortcuts file
aycanogut Jan 6, 2022
ac35700
update render method with element variables
aycanogut Jan 6, 2022
980fc2c
add states to the component
aycanogut Jan 6, 2022
6f605b3
update wrap comment
aycanogut Jan 6, 2022
4df8e99
remove styles import
aycanogut Jan 6, 2022
2f42f92
add history remove handler
aycanogut Jan 6, 2022
a44f93e
add type and comment
aycanogut Jan 6, 2022
97d560d
add dummy history functionality
aycanogut Jan 6, 2022
186abc9
update types
aycanogut Jan 6, 2022
e0e31e4
remove styles
aycanogut Jan 6, 2022
f9e2d29
update import method
aycanogut Jan 6, 2022
28b4f88
update conditional render method
aycanogut Jan 12, 2022
b8aa682
update file import name
aycanogut Jan 12, 2022
f214ec4
update file structure
aycanogut Jan 12, 2022
1bd27e6
update file import name
aycanogut Jan 12, 2022
dc9295e
remove file
aycanogut Jan 12, 2022
b3f79c8
add layout enums
aycanogut Jan 12, 2022
845099c
update strings to enums
aycanogut Jan 12, 2022
6f4e199
add react-icomoon
aycanogut Jan 12, 2022
8e9f9b7
remove files
aycanogut Jan 13, 2022
1ba5ac5
create json file
aycanogut Jan 13, 2022
be13ee4
add react icomoon
aycanogut Jan 13, 2022
d224fe7
update component styles
aycanogut Jan 13, 2022
bb561bc
remove size
aycanogut Jan 13, 2022
e2fa356
add svg viewbox size change functionality
aycanogut Jan 13, 2022
959b715
update icon props
aycanogut Jan 13, 2022
5ce8c58
update icon props
aycanogut Jan 13, 2022
c47751d
update color select method
aycanogut Jan 13, 2022
cc9e354
add color
aycanogut Jan 13, 2022
2082dd5
update onClick type
aycanogut Jan 13, 2022
c35701a
update stories
aycanogut Jan 13, 2022
0e95465
update component name
aycanogut Jan 13, 2022
23c4e99
update spacing
aycanogut Jan 13, 2022
7799213
update variable name
aycanogut Jan 13, 2022
58095e2
update types
aycanogut Jan 13, 2022
bdea7b6
update comment
aycanogut Jan 13, 2022
fd4f2be
move file
aycanogut Jan 14, 2022
2e63bcb
update enum type name
aycanogut Jan 14, 2022
995e8f2
update prop declaring method
aycanogut Jan 14, 2022
7d11513
update types
aycanogut Jan 14, 2022
7999694
update component name and prop declaring
aycanogut Jan 14, 2022
107fd11
update type and remove comment
aycanogut Jan 14, 2022
ac5f86b
remove comment
aycanogut Jan 14, 2022
f09adb9
update types
aycanogut Jan 14, 2022
3a97ba1
rename file
aycanogut Jan 14, 2022
6796645
update return method
aycanogut Jan 14, 2022
2368f18
update component name
aycanogut Jan 14, 2022
bdae82a
update function name
aycanogut Jan 14, 2022
44a1c7d
update icon name
aycanogut Jan 14, 2022
95e70c0
update height
aycanogut Jan 14, 2022
df84364
add prop and type
aycanogut Jan 14, 2022
bb86e92
remove svg manipulation functionality
aycanogut Jan 14, 2022
0fb95c8
update selection file
aycanogut Jan 14, 2022
4ae87e3
remove prop
aycanogut Jan 14, 2022
ae1045f
remove spread
aycanogut Jan 14, 2022
0c5b836
remove comment
aycanogut Jan 14, 2022
177e51a
move file
aycanogut Jan 14, 2022
c6bed78
update imports
aycanogut Jan 14, 2022
d557d99
updat button size
aycanogut Jan 14, 2022
977304c
remove comments
aycanogut Jan 15, 2022
a4fe48b
remove wrapper styles
aycanogut Jan 15, 2022
d7fe01a
add wrapper styles
aycanogut Jan 15, 2022
fc82f66
update classname and remove border
aycanogut Jan 15, 2022
2298d03
remove styles
aycanogut Jan 15, 2022
0b13440
update dependencies
aycanogut Jan 17, 2022
807d8d6
add size
aycanogut Jan 17, 2022
246838e
update spacing
aycanogut Jan 17, 2022
896e8c3
update story name
aycanogut Jan 17, 2022
c78c8e4
update class name
aycanogut Jan 17, 2022
5d153aa
add height
aycanogut Jan 17, 2022
4de49f1
update component and story names
aycanogut Jan 17, 2022
6223c2b
remove resolutions
aycanogut Jan 17, 2022
80840d2
add resolution
aycanogut Jan 17, 2022
a4e8f32
update dependency log
aycanogut Jan 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icomoon": "^2.4.2",
"react-scripts": "5.0.0",
"typescript": "^4.5.4",
"web-vitals": "^2.1.0"
Expand Down Expand Up @@ -73,5 +74,8 @@
"eslint-plugin-storybook": "^0.5.5",
"prettier": "^2.5.1",
"webpack": "^5.65.0"
},
"resolutions": {
"mini-css-extract-plugin": "~2.4.5"
}
}
2 changes: 2 additions & 0 deletions src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';

import Button from '../Button';

import '../../styles/global.css';

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { HTMLAttributes, ReactNode } from 'react';
import cx from 'classnames';

import styles from './Button.module.css';

// types
export interface Props extends HTMLAttributes<HTMLButtonElement> {
children: ReactNode;
variant: 'number' | 'operator' | 'equal';
Expand Down
6 changes: 4 additions & 2 deletions src/components/Buttons/Buttons.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
gap: 3px;
width: 312px;
height: 230px;
margin: auto 0 0 0;
}

.ButtonsStory {
width: 200px;
}
9 changes: 8 additions & 1 deletion src/components/Buttons/Buttons.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import React from 'react';

import Buttons from '../Buttons';

import styles from './Buttons.module.css';
import '../../styles/global.css';

export default {
title: 'Buttons',
component: Buttons
};

export const ButtonGrid = () => <Buttons />;
export const ButtonStory = () => (
<div className={styles.ButtonsStory}>
<Buttons />
</div>
);
4 changes: 3 additions & 1 deletion src/components/Buttons/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import styles from './Buttons.module.css';

import Button from '../Button';

import styles from './Buttons.module.css';

const Buttons = () => {
return (
<section className={styles.Buttons}>
Expand Down
8 changes: 8 additions & 0 deletions src/components/Calculator/Calculator.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.Calculator {
display: flex;
flex-direction: column;
}

.CalculatorStory {
width: 310px;
}
17 changes: 17 additions & 0 deletions src/components/Calculator/Calculator.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';

import Calculator from '../Calculator';

import styles from './Calculator.module.css';
import '../../styles/global.css';

export default {
title: 'Calculator',
component: Calculator
};

export const CalculatorStory = () => (
<div className={styles.CalculatorStory}>
<Calculator />
</div>
);
17 changes: 17 additions & 0 deletions src/components/Calculator/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';

import Screen from '../Screen';
import Buttons from '../Buttons';

import styles from './Calculator.module.css';

const Calculator = () => {
return (
<div className={styles.Calculator}>
<Screen />
<Buttons />
</div>
);
};

export default Calculator;
4 changes: 4 additions & 0 deletions src/components/Header/Header.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Header {
display: block;
margin: 0 auto 0 0;
}
Empty file.
30 changes: 30 additions & 0 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { MouseEventHandler } from 'react';

import { LayoutTypes } from '../../constant';

import Icon from '../Icon';

import styles from './Header.module.css';

export interface Props {
view: string;
setView: Function;
}

const Header = ({ view, setView }: Props) => {
const handleClick: MouseEventHandler = () => {
view === LayoutTypes.Calculator
? setView(LayoutTypes.History)
: setView(LayoutTypes.Calculator);
};

const currentIcon = view === LayoutTypes.Calculator ? 'history' : 'back';

return (
<header className={styles.Header}>
<Icon icon={currentIcon} onClick={handleClick} />
</header>
);
};

export default Header;
19 changes: 19 additions & 0 deletions src/components/History/History.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.History {
display: flex;
flex-direction: column;
justify-content: space-around;
width: 100%;
height: 100%;
}

.Histories {
display: flex;
flex-direction: column;
}

.HistoryWrapper {
width: 320px;
height: 320px;
padding: 0.6rem;
border: 1px solid #fff;
}
17 changes: 17 additions & 0 deletions src/components/History/History.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';

import History from '../History';

import '../../styles/global.css';
import styles from './History.module.css';

export default {
title: 'History',
component: History
};

export const HistoryStory = () => (
<div className={styles.HistoryWrapper}>
<History />
</div>
);
25 changes: 25 additions & 0 deletions src/components/History/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, { useState } from 'react';

import HistoryItem from '../HistoryItem';
import HistoryFooter from '../HistoryFooter';

import styles from './History.module.css';

const History = () => {
const [history, setHistory] = useState([
{ first: 1, operator: '+', second: 3, result: 2 } // hard coded dummy data
]);

return (
<section className={styles.History}>
<div className={styles.Histories}>
{history.map((item, index) => (
<HistoryItem key={index} {...item} />
))}
</div>
<HistoryFooter setHistory={setHistory} />
</section>
);
};

export default History;
6 changes: 6 additions & 0 deletions src/components/HistoryFooter/HistoryFooter.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.HistoryFooter {
display: flex;
align-items: flex-end;
height: 100%;
margin: 0 0 0.2rem auto;
}
14 changes: 14 additions & 0 deletions src/components/HistoryFooter/HistoryFooter.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';

import HistoryFooter, { Props } from '../HistoryFooter';

import '../../styles/global.css';

export default {
title: 'Footer',
component: HistoryFooter
};

export const HistoryFooterStory = (args: JSX.IntrinsicAttributes & Props) => (
<HistoryFooter {...args} />
);
22 changes: 22 additions & 0 deletions src/components/HistoryFooter/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { MouseEventHandler } from 'react';
import Icon from '../Icon';

import styles from './HistoryFooter.module.css';

export interface Props {
setHistory: Function;
}

const HistoryFooter = ({ setHistory }: Props) => {
const clearHistory: MouseEventHandler = () => {
setHistory([]);
};

return (
<footer className={styles.HistoryFooter}>
<Icon icon="garbage" onClick={clearHistory} />
</footer>
);
};

export default HistoryFooter;
25 changes: 25 additions & 0 deletions src/components/HistoryItem/HistoryItem.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.HistoryItem {
display: flex;
flex-direction: column;
margin: 0 0 0 auto;
padding: 0 0.4rem 0.8rem 0.4rem;
}

.Operation {
color: var(--color-text-secondary);
}

.Operation span {
padding: 0.4rem;
}

.Result {
margin: 0.5rem 0 0 auto;
color: var(--color-text-primary);
font-size: calc(var(--font-size) * 2.5);
font-weight: 700;
}

.HistoryItemWrapper {
width: 120px;
}
17 changes: 17 additions & 0 deletions src/components/HistoryItem/HistoryItem.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';

import HistoryItem from '../HistoryItem';

import '../../styles/global.css';
import styles from './HistoryItem.module.css';

export default {
title: 'HistoryItem',
component: HistoryItem
};

export const HistoryItemStory = () => (
<div className={styles.HistoryItemWrapper}>
<HistoryItem first={21} operator="+" second={42} result={63} />
</div>
);
26 changes: 26 additions & 0 deletions src/components/HistoryItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';

import styles from './HistoryItem.module.css';

export interface Props {
first: number;
operator: string;
second: number;
result: number;
}

const HistoryItem = ({ first, operator, second, result }: Props) => {
return (
<div className={styles.HistoryItem}>
<div className={styles.Operation}>
<span>{first}</span>
<span>{operator}</span>
<span>{second}</span>
<span>=</span>
</div>
<div className={styles.Result}>{result}</div>
</div>
);
};

export default HistoryItem;
6 changes: 6 additions & 0 deletions src/components/Icon/Icon.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.Icon {
width: 28px;
height: 28px;
cursor: pointer;
color: var(--color-text-primary);
}
16 changes: 16 additions & 0 deletions src/components/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

import Icon from '../Icon';

import '../../styles/global.css';

export default {
title: 'Icon',
component: Icon
};

export const BackIcon = () => <Icon icon="back" />;

export const HistoryIcon = () => <Icon icon="history" />;

export const RemoveIcon = () => <Icon icon="garbage" />;
17 changes: 17 additions & 0 deletions src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { MouseEventHandler } from 'react';
import IcoMoon from 'react-icomoon';

const iconSet = require('./selection.json');

import styles from './Icon.module.css';

export interface Props {
icon: string;
onClick?: MouseEventHandler<Element>;
}

const Icon = (props: Props) => {
return <IcoMoon iconSet={iconSet} className={styles.Icon} {...props} />;
};

export default Icon;
Loading