From 72249d910520880c44c77445eb0b556280ea967b Mon Sep 17 00:00:00 2001 From: Thiago Chaves Date: Thu, 14 Jul 2022 13:00:34 +0300 Subject: [PATCH] Style fixes * Fix missing navigation shadow * Switch to grid organization at top level * Force calc() sizes to guarantee elements occupy right size --- .../ExpressionCard/ExpressionCard.tsx | 10 ++- .../ExpressionSetCard/ExpressionSetCard.tsx | 8 +- .../ExpressionSetInfo/ExpressionSetInfo.tsx | 12 +-- src/pages/expression-sets/details.tsx | 49 ++++++----- src/pages/expression-sets/index.tsx | 2 +- src/pages/expression-sets/practice.tsx | 39 ++++++--- src/styles/components.css | 83 ++++++++++++------- 7 files changed, 125 insertions(+), 78 deletions(-) diff --git a/src/components/ExpressionCard/ExpressionCard.tsx b/src/components/ExpressionCard/ExpressionCard.tsx index 4d5db1f..b58b912 100644 --- a/src/components/ExpressionCard/ExpressionCard.tsx +++ b/src/components/ExpressionCard/ExpressionCard.tsx @@ -15,10 +15,14 @@ export function ExpressionCard({ }: ExpressionCardProps) { return (
-

{prompt}

- {categories.join(", ")} +

{prompt}

+ + {categories.join(", ")} + {show_description ? ( -
{description}
+
+ {description} +
) : null}
); diff --git a/src/components/ExpressionSetCard/ExpressionSetCard.tsx b/src/components/ExpressionSetCard/ExpressionSetCard.tsx index 909779a..0585d57 100644 --- a/src/components/ExpressionSetCard/ExpressionSetCard.tsx +++ b/src/components/ExpressionSetCard/ExpressionSetCard.tsx @@ -11,9 +11,11 @@ export function ExpressionSetCard({ }: ExpressionSetCardProps) { return (
-

{name}

- {word_count} word(s) -

{description}

+

{name}

+ + {word_count} word(s) + +

{description}

); } diff --git a/src/components/ExpressionSetInfo/ExpressionSetInfo.tsx b/src/components/ExpressionSetInfo/ExpressionSetInfo.tsx index 7d1f93c..b7a573c 100644 --- a/src/components/ExpressionSetInfo/ExpressionSetInfo.tsx +++ b/src/components/ExpressionSetInfo/ExpressionSetInfo.tsx @@ -15,8 +15,8 @@ export function ExpressionSetInfo({ word_count, }: ExpressionSetInfo) { return ( -
-

+
+

{name} - +

- {word_count} word(s) -

{description}

+ + {word_count} word(s) + +

{description}

); } diff --git a/src/pages/expression-sets/details.tsx b/src/pages/expression-sets/details.tsx index c669e61..8d0a3af 100644 --- a/src/pages/expression-sets/details.tsx +++ b/src/pages/expression-sets/details.tsx @@ -17,18 +17,20 @@ const ExpressionSetDetailsPage: NextPage = () => { if (!expression_set) return ( -

Expression set not found

+
+

Expression set not found

+
); - // Fallback for expression set empty + // Fallback for expression set empty TODO fix style const word_count = expression_to_expression_set.filter( (item) => item.expression_set_id === expression_set.id ).length; if (!word_count) return ( -
+
{ return ( -
- -

{/* TODO other details */}

- -
- Practice this set - - +
+
+ +
+
+ + + Practice this set + + +
); diff --git a/src/pages/expression-sets/index.tsx b/src/pages/expression-sets/index.tsx index ab56714..ec09738 100644 --- a/src/pages/expression-sets/index.tsx +++ b/src/pages/expression-sets/index.tsx @@ -9,7 +9,7 @@ const ExpressionSetListPage: NextPage = () => { return ( -
+
{expression_sets.map(({ id, name, description }) => ( { - const { query } = useRouter(); + const { query, pathname } = useRouter(); const { expressions, categories, @@ -26,7 +27,7 @@ const ExpressionSetListPage: NextPage = () => { if (!expression_set) return ( -

Expression set not found

+

Expression set not found

); @@ -40,7 +41,7 @@ const ExpressionSetListPage: NextPage = () => { if (expression_candidates.length === 0) { return ( -

No expressions left in this set

+

No expressions left in this set

); } @@ -54,18 +55,30 @@ const ExpressionSetListPage: NextPage = () => { expression_to_category, }); - console.log("Expressions", expressions); - console.log("Categories", expression_categories); - console.log("Expression", expression); - return ( - category.name)} - description={expression.description} - show_description - /> +
+
+ category.name)} + description={expression.description} + show_description + /> +
+
+ + +
wrong
+
+ + + +
right
+
+ +
+
); }; diff --git a/src/styles/components.css b/src/styles/components.css index 4c59818..73c1f1c 100644 --- a/src/styles/components.css +++ b/src/styles/components.css @@ -42,9 +42,11 @@ /* Page */ .page { - display: flex; - flex-direction: column; - + background-color: lavender; + display: grid; + grid-template-columns: 1fr; + grid-template-rows: 64px calc(100vh - 72px); /* Is there a keyword solution for this? */ + grid-gap: 8px; height: 100vh; margin: auto; max-width: 800px; @@ -53,19 +55,8 @@ .page > main { background-color: lavender; display: block; - flex: 1; position: relative; - - /* Will it conflict with overlays? Move elsewhere? */ - padding: 16px; height: 100%; - overflow-y: auto; -} - -.content-list { - display: grid; - grid-template-columns: 1fr; - grid-gap: 16px; } /* Navigation */ @@ -76,6 +67,12 @@ box-shadow: 0px 5px 5px -5px darkslategray; } +.navigation-bottom { + display: flex; + flex-direction: row; + box-shadow: 0px 5px 5px 5px darkslategray; +} + .navigation > .navigation-li { flex: 1; } @@ -96,6 +93,18 @@ height: 64px; } +.navigation-item-bottom { + display: flex; + flex-shrink: 0; + flex-direction: column; + align-items: center; + justify-content: center; + + background-color: lavenderblush; + border: 1px solid darkslategray; + height: 80px; +} + .navigation-item:hover { background-color: antiquewhite; } @@ -119,21 +128,8 @@ border: 1px solid slategray; } -/* tofix */ - -.details { - color: darkslategray; - font-size: 15px; - margin: 20px 0px; - overflow-y: auto; -} - /* Content organization */ -.content-page { - padding: 16px; -} - .content-card { background-color: lavender; border: 1px solid darkslategray; @@ -145,17 +141,42 @@ display: flex; flex-direction: row; align-items: center; +} + +.content-list { + display: flex; + flex-direction: column; + height: 100%; +} + +.content-list > * + * { + margin-top: 16px; +} + +/* Margins and paddings */ + +.padding-small { + padding: 8px 16px; +} + +.margin-small { margin: 10px 0px; } -.content-paragraph { +.margin-paragraph { margin: 20px 0px 10px; } /* Expression set page */ -.expression-set-page { - display: flex; - flex-direction: column; +.page-with-padding { + padding: 8px 16px 16px; +} + +.page-with-bottom-navigation { + display: grid; + grid-template-columns: 1fr; + grid-template-rows: calc(100% - 88px) 80px; + grid-gap: 8px; height: 100%; }