Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: whole area clickable back buttons #1428

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wivern-co-uk
Copy link
Contributor

@wivern-co-uk wivern-co-uk commented Apr 11, 2023

  • Small refactoring to unify two Stepper components more
  • Make title next to back button clickable

1

2

3

4

Comment on lines +38 to +43
<a onClick={onBack} className={classes.backLink}>
<button className={classes.backButton}>
<BackArrow className={classes.backIcon} />
</button>
) : null}
{title}
</a>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't have <button> inside <a>, <a> without href or <button> without a click handler.

Maybe something like this?

Index: src/components/Step/Step.tsx
<+>UTF-8
===================================================================
@@ -37,10 +37,14 @@
         <div className={classes.titleBar}>
           {onBack !== undefined ? (
             <button onClick={onBack} className={classes.backButton}>
-              <BackArrow className={classes.backIcon} />
+              <div className={classes.backIconSizer}>
+                <BackArrow className={classes.backIcon} />
+              </div>
+              <div>{title}</div>
             </button>
-          ) : null}
-          <div>{title}</div>
+          ) : (
+            <div>{title}</div>
+          )}
           {titleAdornment ? <div className={classes.adornment}>{titleAdornment}</div> : null}
         </div>
       ) : null}
Index: src/components/Step/styles.tsx
<+>UTF-8
===================================================================
@@ -24,19 +24,28 @@
   backButton: {
     margin: 0,
     padding: 0,
-    borderRadius: '50%',
-    width: '24px',
-    height: '24px',
-    background: '#363B63',
+    font: 'inherit',
+    background: 'transparent',
     boxShadow: 'none',
     cursor: 'pointer',
     border: 'none',
-    color: '#F5F5FF',
+    color: 'inherit',
+    flexShrink: 0,
+    flexGrow: 0,
+    display: 'flex',
+    columnGap: '12px',
+    alignItems: 'center',
+  },
+  backIconSizer: {
     flexShrink: 0,
     flexGrow: 0,
     display: 'flex',
     alignItems: 'center',
     justifyContent: 'center',
+    background: '#363B63',
+    borderRadius: '50%',
+    width: '24px',
+    height: '24px',
   },
   backIcon: {
     fill: '#F5F5FF',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants