Skip to content

Commit 49cbb82

Browse files
change
1 parent 29399c5 commit 49cbb82

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

docs/src/App.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,14 @@ const styles = theme => ({
2727
width: '100%',
2828
height: '100vh',
2929
},
30-
menu: {
31-
margin: 'auto',
32-
},
3330
paper: {
3431
width: '100%',
3532
maxWidth: 960,
3633
minHeight: 300,
3734
display: 'flex',
3835
flexDirection: 'column',
3936
justifyContent: 'center',
37+
alignItems: 'center',
4038
},
4139
formControl: {
4240
margin: theme.spacing.unit,
@@ -83,7 +81,6 @@ class App extends Component {
8381
</FormControl>
8482
<Paper className={classes.paper} elevation={4}>
8583
<FloatingMenu
86-
className={classes.menu}
8784
slideSpeed={500}
8885
direction={direction}
8986
>
@@ -99,14 +96,14 @@ class App extends Component {
9996
iconColor="black"
10097
order={1}
10198
backgroundColor="white"
102-
size={56}
99+
size={40}
103100
/>
104101
<ChildButton
105102
iconButton={MdAdd}
106103
iconColor="black"
107104
order={2}
108105
backgroundColor="white"
109-
size={56}
106+
size={40}
110107
/>
111108
</FloatingMenu>
112109
</Paper>

src/ChildButton.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import styled from 'styled-jss';
33
import PropTypes from 'prop-types';
44

55
const Wrapper = styled('li')(
6-
({ isOpen, slideSpeed, backgroundColor, size, iconColor }) => ({
6+
({ isOpen, slideSpeed, backgroundColor, size, iconColor, margin }) => ({
7+
margin,
8+
backgroundColor,
79
display: 'flex',
810
border: 'none',
911
borderRadius: '50%',
@@ -17,7 +19,6 @@ const Wrapper = styled('li')(
1719
alignItems: 'center',
1820
opacity: isOpen ? 1 : 0,
1921
transition: `all ${slideSpeed}ms`,
20-
backgroundColor,
2122
width: size,
2223
height: size,
2324
'& > a > svg': {
@@ -53,19 +54,14 @@ class ChildButton extends Component {
5354
iconButton: PropTypes.func.isRequired,
5455
iconColor: PropTypes.string,
5556
isOpen: PropTypes.bool,
56-
direction: PropTypes.string,
57-
offset: PropTypes.number,
5857
size: PropTypes.number,
58+
margin: PropTypes.number,
5959
};
6060

6161
static defaultProps = {
62-
direction: 'down',
6362
iconColor: 'black',
64-
offset: 0,
65-
size: {
66-
main: 56,
67-
child: 56,
68-
},
63+
size: '40',
64+
margin: 0,
6965
isOpen: false,
7066
};
7167

src/FloatingMenu.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import styled from 'styled-components';
43
import styledJss from 'styled-jss';
54

65
const DIRECTIONS = {
@@ -18,6 +17,11 @@ const StyledUl = styledJss('ul')(
1817
margin: '0',
1918
padding: '0',
2019
flexDirection: DIRECTIONS[direction],
20+
justifyContent: 'center',
21+
alignItems: 'center',
22+
'& > a + li, li + li': {
23+
marginLeft: 8,
24+
},
2125
}),
2226
);
2327

@@ -31,7 +35,6 @@ class FloatingMenu extends Component {
3135

3236
static defaultProps = {
3337
className: '',
34-
background: 'palevioletred',
3538
slideSpeed: 500,
3639
direction: 'down',
3740
};

src/MainButton.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import styled from 'styled-jss';
44
import PropTypes from 'prop-types';
55

66
const Wrapper = styled('a')(
7-
({ backgroundColor, size }) => ({
7+
({ backgroundColor, size, iconColor }) => ({
8+
'& > a > svg': {
9+
fill: iconColor,
10+
},
811
zIndex: '1',
912
display: 'flex',
1013
border: 'none',

0 commit comments

Comments
 (0)