Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 719934f

Browse files
authored
Merge pull request #15 from gnosis/development
new release 0.1.3
2 parents ef95c60 + e16ffbc commit 719934f

File tree

12 files changed

+104
-38
lines changed

12 files changed

+104
-38
lines changed

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Gnosis Ltd
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gnosis.pm/safe-react-components",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Gnosis UI components",
55
"main": "dist/index.min.js",
66
"typings": "dist/index.d.ts",
@@ -24,6 +24,7 @@
2424
"classnames": "^2.2.6",
2525
"polished": "3.6.3",
2626
"react-docgen-typescript-loader": "^3.7.2",
27+
"react-media": "^1.10.0",
2728
"url-loader": "^4.1.0"
2829
},
2930
"devDependencies": {

src/inputs/Button/button.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const withIcon = () => (
5757
onClick={() => alert('click')}>
5858
text
5959
</Button>
60-
<Button size="lg" iconType="addressBook" color="primary" variant="outlined">
60+
<Button size="lg" iconType="addressBook" color="error" variant="outlined">
6161
text
6262
</Button>
6363
<Button

src/inputs/Button/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ const Button = ({
5050

5151
return (
5252
<BootstrapButton {...rest}>
53-
{iconType && <Icon size="md" color="white" type={iconType} />}
53+
{iconType && (
54+
<Icon
55+
size="md"
56+
color={variant === 'contained' ? 'white' : color}
57+
type={iconType}
58+
/>
59+
)}
5460
{children}
5561
</BootstrapButton>
5662
);

src/inputs/ButtonLink/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Theme } from '../../theme';
55
import Icon, { IconType } from '../../dataDisplay/Icon';
66
import { Text } from '../../index';
77

8-
type Props = {
8+
export interface Props extends React.ComponentPropsWithoutRef<'button'> {
99
iconType?: keyof IconType;
1010
color: keyof Theme['colors'];
1111
children: any;

src/inputs/Select/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Props = {
3333
id?: string;
3434
};
3535

36-
function Select({ items, activeItemId, onItemClick, id }: Props) {
36+
function Select({ items, activeItemId, onItemClick, id, ...rest }: Props) {
3737
const [open, setOpen] = React.useState(false);
3838

3939
const handleChange = (event: React.ChangeEvent<{ value: unknown }>) => {
@@ -58,7 +58,8 @@ function Select({ items, activeItemId, onItemClick, id }: Props) {
5858
onClose={handleClose}
5959
onOpen={handleOpen}
6060
value={activeItemId}
61-
onChange={handleChange}>
61+
onChange={handleChange}
62+
{...rest}>
6263
{items.map((i) => {
6364
return (
6465
<MenuItem value={i.id} key={i.id}>

src/navigation/Stepper/DotStep.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ const Circle = styled.div<{ disabled: boolean; error?: boolean }>`
2121
display: flex;
2222
justify-content: center;
2323
align-items: center;
24-
25-
`;
2624
27-
const StyledIcon = styled(Icon)`
28-
/* span {margin:0px} */
29-
margin-right: 0;
25+
svg {
26+
margin-top: 4px;
27+
}
3028
`;
3129

3230
type Props = {
@@ -37,7 +35,7 @@ type Props = {
3735
const DotStep = ({ currentIndex, dotIndex, error }: Props) => {
3836
return (
3937
<Circle disabled={dotIndex > currentIndex} error={error}>
40-
{dotIndex < currentIndex ? <StyledIcon size="sm" type="check" color="white" /> : dotIndex}
38+
{dotIndex < currentIndex ? <Icon size="sm" type="check" color="white" /> : dotIndex + 1}
4139
</Circle>
4240
);
4341
};

src/navigation/Stepper/index.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from "react";
2-
import StepperMUI from "@material-ui/core/Stepper";
3-
import StepMUI from "@material-ui/core/Step";
4-
import StepLabelMUI from "@material-ui/core/StepLabel";
5-
import styled from "styled-components";
1+
import React from 'react';
2+
import StepperMUI from '@material-ui/core/Stepper';
3+
import StepMUI from '@material-ui/core/Step';
4+
import StepLabelMUI from '@material-ui/core/StepLabel';
5+
import styled from 'styled-components';
66

7-
import DotStep from "./DotStep";
7+
import DotStep from './DotStep';
88

99
const StyledStepLabel = styled.p<any>`
1010
&& {
@@ -30,7 +30,7 @@ type Props = {
3030
steps: Array<{ id: string; label: string }>;
3131
activeStepIndex: number;
3232
error?: boolean;
33-
orientation: "vertical" | "horizontal";
33+
orientation: 'vertical' | 'horizontal';
3434
};
3535

3636
const Stepper = ({ steps, error, activeStepIndex, orientation }: Props) => {
@@ -46,13 +46,11 @@ const Stepper = ({ steps, error, activeStepIndex, orientation }: Props) => {
4646
dotIndex={index}
4747
error={index === activeStepIndex && error}
4848
/>
49-
}
50-
>
49+
}>
5150
<StyledStepLabel
5251
error={index === activeStepIndex && error}
5352
index={index}
54-
activeStepIndex={activeStepIndex}
55-
>
53+
activeStepIndex={activeStepIndex}>
5654
{s.label}
5755
</StyledStepLabel>
5856
</StepLabelMUI>

src/utils/modals/GenericModal/index.tsx

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { makeStyles } from '@material-ui/core/styles';
44
import styled from 'styled-components';
55
import cn from 'classnames';
66
import { rgba } from 'polished';
7+
import Media from 'react-media';
78

89
import theme from '../../../theme';
910
import { Icon, Title } from '../../../index';
@@ -14,7 +15,6 @@ const StyledButton = styled.button`
1415
padding: 5px;
1516
width: 26px;
1617
height: 26px;
17-
1818
1919
span {
2020
margin-right: 0px;
@@ -37,8 +37,11 @@ const TitleSection = styled.div`
3737
border-bottom: 2px solid ${({ theme }) => theme.colors.separator};
3838
`;
3939

40-
const BodySection = styled.div<{ withoutBodyPadding?: boolean }>`
41-
max-height: 460px;
40+
const BodySection = styled.div<{
41+
withoutBodyPadding?: boolean;
42+
smallHeight: boolean;
43+
}>`
44+
max-height: ${({ smallHeight }) => (smallHeight ? '280px' : '460px')};
4245
overflow-y: auto;
4346
padding: ${({ withoutBodyPadding }) =>
4447
withoutBodyPadding ? '0' : '16px 24px'};
@@ -67,9 +70,13 @@ const useStyles = makeStyles({
6770
},
6871

6972
paper: {
70-
position: 'absolute',
71-
top: '121px',
72-
minWidth: '450px',
73+
position: (props: { smallHeight: boolean }) =>
74+
props.smallHeight ? 'relative' : 'absolute',
75+
top: (props: { smallHeight: boolean }) =>
76+
props.smallHeight ? 'unset' : '121px',
77+
minWidth: '500px',
78+
width: (props: { smallHeight: boolean }) =>
79+
props.smallHeight ? '500px' : 'inherit',
7380
backgroundColor: theme.colors.white,
7481
borderRadius: '8px',
7582
boxShadow: `0 0 ${theme.colors.shadow.opacity} 0 ${theme.colors.shadow.color}`,
@@ -85,10 +92,12 @@ const GenericModal = ({
8592
footer,
8693
onClose,
8794
title,
88-
withoutBodyPadding
89-
}: Props) => {
90-
const classes = useStyles();
91-
95+
withoutBodyPadding,
96+
smallHeight
97+
}: Props & { smallHeight: boolean }) => {
98+
const classes = useStyles({ smallHeight });
99+
console.log('smallHeight: ', smallHeight);
100+
debugger;
92101
return (
93102
<Modal open className={classes.modal} title="GenericModal">
94103
<div className={cn(classes.paper)}>
@@ -101,7 +110,9 @@ const GenericModal = ({
101110
</StyledButton>
102111
</TitleSection>
103112

104-
<BodySection withoutBodyPadding={withoutBodyPadding}>
113+
<BodySection
114+
withoutBodyPadding={withoutBodyPadding}
115+
smallHeight={smallHeight}>
105116
{body}
106117
</BodySection>
107118

@@ -111,4 +122,9 @@ const GenericModal = ({
111122
);
112123
};
113124

114-
export default GenericModal;
125+
const MediaModal = (props: Props) => (
126+
<Media query={{ maxHeight: 500 }}>
127+
{(matches) => <GenericModal {...props} smallHeight={matches} />}
128+
</Media>
129+
);
130+
export default MediaModal;

src/utils/modals/ManageListModal/ManageListModal.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const modal = () => {
3333
id: '3',
3434
iconUrl: 'someUrl3',
3535
name: 'three',
36-
description: 'ever since the 1500s',
36+
description: 'Long desc ever since the 1500s do not finish over the ocean of this',
3737
checked: true
3838
}
3939
]);

0 commit comments

Comments
 (0)