-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from shefing/Initialize_Straightforward_settings
Initialization "הגדרת הישר " corresponding to the line of numbers
- Loading branch information
Showing
9 changed files
with
190 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { createContext, ReactNode, Dispatch, SetStateAction, useState } from "react"; | ||
|
||
export enum LineRange { | ||
ten = 11, | ||
twenty = 21, | ||
hundred = 101, | ||
hundredCircular = 10, | ||
} | ||
|
||
const KindLine = createContext<{ kind: LineRange; setKind: Dispatch<SetStateAction<LineRange>> } | undefined>({ | ||
kind: LineRange.ten, | ||
setKind: () => {}, | ||
}); | ||
|
||
interface ProviderProps { | ||
children: ReactNode; | ||
} | ||
|
||
function Provider({ children }: ProviderProps) { | ||
const [kind, setKind] = useState(LineRange.ten); | ||
|
||
const kindShare = { | ||
kind, | ||
setKind, | ||
}; | ||
|
||
return <KindLine.Provider value={kindShare}>{children}</KindLine.Provider>; | ||
} | ||
|
||
export { Provider }; | ||
export default KindLine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useContext } from "react"; | ||
import KindLine, { LineRange } from "../context/kindNumberLine"; | ||
|
||
interface IProps { | ||
labels: number[]; | ||
startIndex: number; | ||
} | ||
const Numbers = ({ labels, startIndex }: IProps) => { | ||
const context = useContext(KindLine); | ||
if (!context) { | ||
return null; | ||
} | ||
const { kind, setKind } = context; | ||
var flag = kind == LineRange.hundredCircular; | ||
return ( | ||
<> | ||
{labels.slice(startIndex, startIndex + 21).map((label) => ( | ||
<div | ||
key={label} | ||
className={`text-xl text-color flex flex-col items-center ${flag && label % 50 == 0 ? "font-bold" : !flag && label % 5 === 0 && "font-bold"}`} | ||
> | ||
<div className="h-3 border-l-2 border-gray-900 w-1366 flex-shrink-0" /> | ||
{label} | ||
</div> | ||
))} | ||
</> | ||
); | ||
}; | ||
export default Numbers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.