-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ellipsified result column headers with icons (#343)
* Add results header icons * Make results cells padding consistent * Add new words icon * Use GeoAlt instead of GeoAltFill * Fix columns alignment * Move ResultColumn type * Remove "C" from Squares icon * Make header icons smaller * Optimize useTranslate * Refactor useColumns * Extract Header component * Refactor useColumns to a map * Format code * Fix loading state border radius * Fix loading state styling in the corners * Fix alignment in Words icon * Format code * ESLint
- Loading branch information
1 parent
68d7f64
commit 39aeb23
Showing
31 changed files
with
415 additions
and
241 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
.dim { | ||
position: absolute; | ||
inset: 0; | ||
border-radius: inherit; | ||
} | ||
|
||
.loading { | ||
|
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
99 changes: 99 additions & 0 deletions
99
packages/scrabble-solver/src/components/Results/Header.tsx
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,99 @@ | ||
import { FunctionComponent } from 'react'; | ||
|
||
import { useAppLayout, useColumns } from 'hooks'; | ||
import { GeoAlt, OneTwoThree, Square, SquareA, SquareB, Squares, Words } from 'icons'; | ||
import { RESULTS_COLUMN_WIDTH } from 'parameters'; | ||
import { ResultColumnId } from 'types'; | ||
|
||
import HeaderButton from './HeaderButton'; | ||
import styles from './Results.module.scss'; | ||
|
||
const Results: FunctionComponent = () => { | ||
const { resultWordWidth } = useAppLayout(); | ||
const columns = useColumns(); | ||
|
||
return ( | ||
<div className={styles.header}> | ||
{columns[ResultColumnId.Coordinates] && ( | ||
<HeaderButton | ||
className={styles.coordinates} | ||
Icon={GeoAlt} | ||
id={ResultColumnId.Coordinates} | ||
style={{ flexBasis: RESULTS_COLUMN_WIDTH[ResultColumnId.Coordinates] }} | ||
translationKey="settings.showCoordinates" | ||
/> | ||
)} | ||
|
||
{columns[ResultColumnId.Word] && ( | ||
<HeaderButton | ||
className={styles.word} | ||
id={ResultColumnId.Word} | ||
style={{ flexBasis: resultWordWidth }} | ||
translationKey="common.word" | ||
/> | ||
)} | ||
|
||
{columns[ResultColumnId.TilesCount] && ( | ||
<HeaderButton | ||
className={styles.stat} | ||
Icon={Squares} | ||
id={ResultColumnId.TilesCount} | ||
style={{ flexBasis: RESULTS_COLUMN_WIDTH[ResultColumnId.TilesCount] }} | ||
translationKey="common.tiles" | ||
/> | ||
)} | ||
|
||
{columns[ResultColumnId.VowelsCount] && ( | ||
<HeaderButton | ||
className={styles.stat} | ||
Icon={SquareA} | ||
id={ResultColumnId.VowelsCount} | ||
style={{ flexBasis: RESULTS_COLUMN_WIDTH[ResultColumnId.VowelsCount] }} | ||
translationKey="common.vowels" | ||
/> | ||
)} | ||
|
||
{columns[ResultColumnId.ConsonantsCount] && ( | ||
<HeaderButton | ||
className={styles.stat} | ||
Icon={SquareB} | ||
id={ResultColumnId.ConsonantsCount} | ||
style={{ flexBasis: RESULTS_COLUMN_WIDTH[ResultColumnId.ConsonantsCount] }} | ||
translationKey="common.consonants" | ||
/> | ||
)} | ||
|
||
{columns[ResultColumnId.BlanksCount] && ( | ||
<HeaderButton | ||
className={styles.stat} | ||
Icon={Square} | ||
id={ResultColumnId.BlanksCount} | ||
style={{ flexBasis: RESULTS_COLUMN_WIDTH[ResultColumnId.BlanksCount] }} | ||
translationKey="common.blanks" | ||
/> | ||
)} | ||
|
||
{columns[ResultColumnId.WordsCount] && ( | ||
<HeaderButton | ||
className={styles.stat} | ||
Icon={Words} | ||
id={ResultColumnId.WordsCount} | ||
style={{ flexBasis: RESULTS_COLUMN_WIDTH[ResultColumnId.WordsCount] }} | ||
translationKey="common.words" | ||
/> | ||
)} | ||
|
||
{columns[ResultColumnId.Points] && ( | ||
<HeaderButton | ||
className={styles.points} | ||
Icon={OneTwoThree} | ||
id={ResultColumnId.Points} | ||
style={{ flexBasis: RESULTS_COLUMN_WIDTH[ResultColumnId.Points] }} | ||
translationKey="common.points" | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Results; |
31 changes: 18 additions & 13 deletions
31
packages/scrabble-solver/src/components/Results/HeaderButton.tsx
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.