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

Size property doesn't work properly on extended FABs with text #13891

Closed
eanesparrago opened this issue Dec 13, 2018 · 1 comment
Closed

Size property doesn't work properly on extended FABs with text #13891

eanesparrago opened this issue Dec 13, 2018 · 1 comment
Labels
bug 🐛 Something doesn't work component: Fab The React component. good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@eanesparrago
Copy link

eanesparrago commented Dec 13, 2018

Hello. It seems like the size properties small and medium doesn't work on extended FABs with text.

Expected Behavior 🤔

Extended FAB would resize accordingly.

Current Behavior 😯

It does not.

Examples 🌈

<Fab className={classes.actionButton} variant="extended" onClick={this.props.createDialogToggle} > <AddCircleIcon className={classes.actionIcon} /> New Job Order </Fab>
image

<Fab className={classes.actionButton} variant="extended" size="medium" onClick={this.props.createDialogToggle} > <AddCircleIcon className={classes.actionIcon} /> New Job Order </Fab>
image

@eanesparrago eanesparrago changed the title Size property doesn't work properly on extended FABs Size property doesn't work properly on extended FABs with text Dec 13, 2018
@oliviertassinari oliviertassinari added component: Fab The React component. bug 🐛 Something doesn't work good first issue Great for first contributions. Enable to learn the contribution process. labels Dec 16, 2018
@oliviertassinari
Copy link
Member

@LJEsp Thank you for raising the issue. It's definitely broken. We should be able to solve the issue with something like this:

capture d ecran 2018-12-16 a 21 15 41

Do you want to give it a shot :)?

--- a/docs/src/pages/demos/buttons/ButtonSizes.js
+++ b/docs/src/pages/demos/buttons/ButtonSizes.js
@@ -6,11 +6,15 @@ import Fab from '@material-ui/core/Fab';
 import IconButton from '@material-ui/core/IconButton';
 import AddIcon from '@material-ui/icons/Add';
 import DeleteIcon from '@material-ui/icons/Delete';
+import NavigationIcon from '@material-ui/icons/Navigation';

 const styles = theme => ({
   margin: {
     margin: theme.spacing.unit,
   },
+  extendedIcon: {
+    marginRight: theme.spacing.unit,
+  },
 });

 function ButtonSizes(props) {
@@ -61,6 +65,32 @@ function ButtonSizes(props) {
           <AddIcon />
         </Fab>
       </div>
+      <div>
+        <Fab
+          variant="extended"
+          size="small"
+          color="primary"
+          aria-label="Add"
+          className={classes.margin}
+        >
+          <NavigationIcon className={classes.extendedIcon} />
+          Extended
+        </Fab>
+        <Fab
+          variant="extended"
+          size="medium"
+          color="primary"
+          aria-label="Add"
+          className={classes.margin}
+        >
+          <NavigationIcon className={classes.extendedIcon} />
+          Extended
+        </Fab>
+        <Fab variant="extended" color="primary" aria-label="Add" className={classes.margin}>
+          <NavigationIcon className={classes.extendedIcon} />
+          Extended
+        </Fab>
+      </div>
       <div>
         <IconButton aria-label="Delete" className={classes.margin}>
           <DeleteIcon fontSize="small" />
diff --git a/packages/material-ui/src/Fab/Fab.js b/packages/material-ui/src/Fab/Fab.js
index 3c7eb4233..fbdc0aa76 100644
--- a/packages/material-ui/src/Fab/Fab.js
+++ b/packages/material-ui/src/Fab/Fab.js
@@ -84,8 +84,23 @@ export const styles = theme => ({
     borderRadius: 48 / 2,
     padding: '0 16px',
     width: 'auto',
+    minHeight: 'auto',
     minWidth: 48,
     height: 48,
+    '&$sizeSmall' : {
+      width: 'auto',
+      padding: '0 8px',
+      borderRadius: 34 / 2,
+      minWidth: 34,
+      height: 34,
+    },
+    '&$sizeMedium' : {
+      width: 'auto',
+      padding: '0 16px',
+      borderRadius: 40 / 2,
+      minWidth: 40,
+      height: 40,
+    },
   },
   /* Styles applied to the ButtonBase root element if the button is keyboard focused. */
   focusVisible: {},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: Fab The React component. good first issue Great for first contributions. Enable to learn the contribution process.
Projects
None yet
Development

No branches or pull requests

2 participants