Skip to content

Commit 1d3c7b7

Browse files
committed
Small updates for FTC wizard
1 parent 698b220 commit 1d3c7b7

File tree

5 files changed

+54
-43
lines changed

5 files changed

+54
-43
lines changed

packages/sitebuilder/sitebuilder.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ declare global {
6767
url?: string;
6868
target?: '_blank' | '_self';
6969
wizardHash?: string;
70+
target?: string;
7071
}
7172

7273
interface SetupCardInterface {
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import { Box } from '@mui/material';
22
import { styled } from '@mui/material/styles';
33

4-
const mBottom = '68px';
5-
const mTop = '57px';
4+
const screenBottomMargin = '68px';
5+
const screenTopMargin = '57px';
66

77
const ScreenWrapper: any = styled(Box, {
88
name: 'FtcWrapper',
9-
slot: 'Root',
9+
slot: 'Root'
1010
})(() => ({
1111
display: 'flex',
1212
flexDirection: 'column',
1313
justifyContent: 'center',
1414
alignItems: 'center',
15-
marginTop: mTop,
16-
marginBottom: mBottom,
17-
minHeight: `calc(100vh - ${ mTop } - ${ mBottom })`,
15+
marginTop: screenTopMargin,
16+
marginBottom: screenBottomMargin,
17+
minHeight: `calc(100vh - ${ screenTopMargin } - ${ screenBottomMargin })`,
1818
'& .WmeFormRoot': {
19-
marginTop: '16px',
20-
},
19+
marginTop: '16px'
20+
}
2121
}));
2222

2323
export default ScreenWrapper;

packages/sitebuilder/src/wizards/first-time-configuration/screens/Goals.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { CardSelectGroup, CardSelectItem } from '@moderntribe/wme-ui';
22
import { Box, Stack, Typography } from '@mui/material';
33
import { useFirstTimeConfiguration } from '@sb/hooks';
4-
import { NewspaperIcon, GraduationIcon, ShoppingBagIcon, TicketIcon } from '@sb/icons';
4+
import {
5+
NewspaperIcon,
6+
GraduationIcon,
7+
ShoppingBagIcon,
8+
TicketIcon
9+
} from '@sb/icons';
510
import { FtcStringData } from '@ftc/data/constants';
611
const { siteDetails } = FtcStringData;
712

@@ -29,16 +34,21 @@ const cards = [
2934
];
3035

3136
const Goals = () => {
32-
const { ftcState: { form }, setFormValue } = useFirstTimeConfiguration();
37+
const {
38+
ftcState: { form },
39+
setFormValue
40+
} = useFirstTimeConfiguration();
3341

3442
const handleSelect = (value: string[]) => {
3543
setFormValue('goals', value);
3644
};
3745

3846
return (
39-
<Box sx={ { maxWidth: 560, width: 560 } }>
47+
<Box sx={ { maxWidth: 560 } }>
4048
<Stack spacing={ 2 }>
41-
<Typography component="h3" sx={ { fontWeight: 500 } }>{ siteDetails.goalsSelectText }</Typography>
49+
<Typography component="h3" sx={ { fontWeight: 500 } }>
50+
{ siteDetails.goalsSelectText }
51+
</Typography>
4252
<CardSelectGroup
4353
orientation="vertical"
4454
cardPadding="sm"
@@ -55,7 +65,6 @@ const Goals = () => {
5565
/>
5666
)) }
5767
</CardSelectGroup>
58-
5968
</Stack>
6069
</Box>
6170
);

packages/wme-ui/src/components/chips-input/chips-input.stories.mdx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ import { ChipInput } from "..";
3636
}}
3737
/>
3838

39-
export const Template = (args) => (
40-
<div style={{ width: 350 }}>
41-
<ChipInput {...args} />
42-
</div>
43-
);
39+
export const Template = (args) => {
40+
const [tags, setTags] = React.useState(args.tags);
41+
const handleSelect = (listOfChips) => {
42+
setTags(listOfChips);
43+
}
44+
return (
45+
<div style={{ width: 350 }}>
46+
<ChipInput {...args} tags={tags} selectedTags={ handleSelect } />
47+
</div>
48+
);
49+
};
4450

4551
# Text Input
4652

@@ -60,16 +66,23 @@ A styled version of <a href="https://mui.com/material-ui/api/input-base/" target
6066
import React from 'react';
6167
import { ChipInput } from '@moderntribe/wme';
6268
63-
const handleSelect = (listOfChips) => {
64-
console.log(listOfChips);
65-
}
69+
export const MyChipInput = (props) => {
70+
const [tags, setTags] = useState([]);
71+
72+
const handleSelect = (listOfChips) => {
73+
console.log(listOfChips);
74+
setTags(listOfChips);
75+
}
6676
67-
export const MyChipInput = (props) => (
68-
<ChipInput
69-
tags={['chip 1', 'chip 2']}
70-
placeholder="Placeholder text"
71-
/>
72-
)
77+
return (
78+
<ChipInput
79+
selectedTags={ handleSelect }
80+
placeholder="Type tags here..."
81+
tags={ tags }
82+
/>
83+
);
84+
85+
}
7386
7487
export default MyChipInput;
7588
```

packages/wme-ui/src/components/chips-input/chips-input.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ const StyledChipInput = styled(TextField, {
4949
},
5050
}));
5151

52-
const ChipsInput: React.FC<ChipsInputProps> = ({
53-
tags,
54-
selectedTags,
55-
...rest
56-
}) => {
52+
const ChipsInput: React.FC<ChipsInputProps> = ({ tags = [], selectedTags, ...rest }) => {
5753
const [inputValue, setInputValue] = useState('');
5854

5955
const deleteChip = (item: string) => () => {
@@ -71,7 +67,7 @@ const ChipsInput: React.FC<ChipsInputProps> = ({
7167
if (isEnter || isComma) {
7268
evt.preventDefault();
7369
const newSelectedItems = [...tags];
74-
const duplicatedValues = newSelectedItems.indexOf(inputValue.trim());
70+
const duplicatedValues = newSelectedItems.indexOf(trimmedInput);
7571

7672
if (duplicatedValues !== -1) {
7773
setInputValue('');
@@ -83,9 +79,7 @@ const ChipsInput: React.FC<ChipsInputProps> = ({
8379
setInputValue('');
8480
}
8581

86-
if (
87-
isBackspace && inputValue.length === 0 && tags.length > 0
88-
) {
82+
if (isBackspace && inputValue.length === 0 && tags.length > 0) {
8983
selectedTags(tags.slice(0, tags.length - 1));
9084
}
9185
};
@@ -97,13 +91,7 @@ const ChipsInput: React.FC<ChipsInputProps> = ({
9791
fullWidth: true,
9892
autoComplete: 'false',
9993
startAdornment: tags.map((item) => (
100-
<Chip
101-
size="small"
102-
key={item}
103-
tabIndex={-1}
104-
label={item}
105-
onDelete={deleteChip(item)}
106-
/>
94+
<Chip size="small" key={item} tabIndex={-1} label={item} onDelete={deleteChip(item)} />
10795
)),
10896
value: inputValue,
10997
onKeyUp: handleKeyDown,

0 commit comments

Comments
 (0)