Skip to content

Commit

Permalink
Changed ICharToDigit from interface to type. Renamed default charToDi…
Browse files Browse the repository at this point in the history
…git to defaultCharMap
  • Loading branch information
lvil committed Dec 3, 2024
1 parent 291e00e commit f3f20a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/Digit.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Segment from "./Segment";
import React, { useEffect, useState } from "react";

import charToDigit, { ICharToDigit } from "../utils/charToDigit";
import charToDigit, { CharToDigit } from "../utils/charToDigit";

const letters = ["A", "B", "C", "D", "E", "F", "G"] as const;

Expand All @@ -12,7 +12,7 @@ type DigitType = {
color: string;
height: number;
skew: boolean;
charMap?: ICharToDigit;
charMap?: CharToDigit;
};


Expand Down
4 changes: 2 additions & 2 deletions src/components/Display.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Digit } from "./Digit";
import React, { useEffect, useState } from "react";
import charToDigit, { ICharToDigit } from "../utils/charToDigit";
import charToDigit, { CharToDigit } from "../utils/charToDigit";

type DisplayType = {
count: number;
Expand All @@ -9,7 +9,7 @@ type DisplayType = {
color: string;
backgroundColor?: string;
skew: boolean;
charMap?: ICharToDigit;
charMap?: CharToDigit;
};

export const Display = ({
Expand Down
10 changes: 4 additions & 6 deletions src/utils/charToDigit.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export interface ICharToDigit {
[key: string]: [number,number,number,number,number,number,number]
}
export type CharToDigit = Record<string, [number, number, number, number, number, number, number]>;

const charToDigit: ICharToDigit = {
const defaultCharMap: CharToDigit = {
"0": [1, 1, 1, 1, 1, 1, 0],
"1": [0, 1, 1, 0, 0, 0, 0],
"2": [1, 1, 0, 1, 1, 0, 1],
Expand All @@ -21,6 +19,6 @@ const charToDigit: ICharToDigit = {
e: [1, 0, 0, 1, 1, 1, 1],
f: [1, 0, 0, 0, 1, 1, 1],
"-": [0, 0, 0, 0, 0, 0, 1],
} as ICharToDigit;
} as CharToDigit;

export default charToDigit;
export default defaultCharMap;

0 comments on commit f3f20a8

Please sign in to comment.