Skip to content

Commit

Permalink
Refactoring#4
Browse files Browse the repository at this point in the history
  • Loading branch information
hacagahasanli committed Apr 6, 2023
1 parent b65cd62 commit ab9e45b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body style="cursor: default ;">
<body style="cursor: default;background: rgb(247, 247, 247);">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/components/KeyItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const KeyItem = ({ id, size, name, subName, c, img, hasImage }: IKeyItemT

const isUpperCasedValue = capsClicked && validValues.includes(name)

const isActive = !(!subName) && shiftClicked
const isActive = !!subName && shiftClicked

const currentScript = hasImage && img
? <Icon name={img} />
Expand Down
12 changes: 12 additions & 0 deletions src/components/TextArea/ITextArea.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
interface IKeyClickedSelector {
keyClicked: {
capsClicked: boolean;
}
}
interface IKeyBoardSelector {
keyboard: {
typedValue: string[];
}
}

export type { IKeyClickedSelector, IKeyBoardSelector }
12 changes: 1 addition & 11 deletions src/components/TextArea/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import styled from "styled-components"
import { useSelector } from "react-redux"
import { ITextareaProps } from '../../types/keyClickedTypes/index';

interface IKeyClickedSelector {
keyClicked: {
capsClicked: boolean;
}
}
interface IKeyBoardSelector {
keyboard: {
typedValue: string[];
}
}
import { IKeyBoardSelector } from "./ITextArea";

export const TextArea = () => {
const { typedValue } = useSelector((state: IKeyBoardSelector) => state.keyboard)
Expand Down
2 changes: 1 addition & 1 deletion src/store/reducers/keyboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const KeyboardSlice = createSlice({
},
addClickedKeyValue: (state: any, action: AddClickedKeyValueAction) => {
const { subName, name, capsClicked, shiftClicked, texts } = action.payload;
const hasSubName = !(!subName);
const hasSubName = !!subName;
const key = state.keyCombination.join("")

key === "ctrlv" && (texts?.split('')
Expand Down

0 comments on commit ab9e45b

Please sign in to comment.