Skip to content

Commit 4ec8ac1

Browse files
committed
Reword 'toggle' to 'shrinkExpand' throughout code.
1 parent bfe2877 commit 4ec8ac1

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

src/components/cards/card.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
flex-direction: row;
115115
}
116116

117-
.toggle-button {
117+
.shrink-expand-button {
118118
cursor: pointer;
119119
color: white;
120120
display: flex;
@@ -124,7 +124,7 @@
124124
padding: 0.75rem;
125125
}
126126

127-
.toggle-button:hover, .all-button:hover {
127+
.shrink-expand-button:hover, .all-button:hover {
128128
background-color: $ui-black-transparent;
129129
}
130130

src/components/cards/cards.jsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import closeIcon from './icon--close.svg';
1818
import {translateVideo} from '../../lib/libraries/decks/translate-video.js';
1919
import {translateImage} from '../../lib/libraries/decks/translate-image.js';
2020

21-
const CardHeader = ({onCloseCards, onToggleCards, onShowAll, totalSteps, step, toggle}) => (
22-
<div className={toggle ? styles.headerButtons : classNames(styles.headerButtons, styles.headerButtonsHidden)}>
21+
const CardHeader = ({onCloseCards, onShrinkExpandCards, onShowAll, totalSteps, step, expanded}) => (
22+
<div className={expanded ? styles.headerButtons : classNames(styles.headerButtons, styles.headerButtonsHidden)}>
2323
<div
2424
className={styles.allButton}
2525
onClick={onShowAll}
@@ -47,14 +47,14 @@ const CardHeader = ({onCloseCards, onToggleCards, onShowAll, totalSteps, step, t
4747
) : null}
4848
<div className={styles.headerButtonsRight}>
4949
<div
50-
className={styles.toggleButton}
51-
onClick={onToggleCards}
50+
className={styles.shrinkExpandButton}
51+
onClick={onShrinkExpandCards}
5252
>
5353
<img
5454
draggable={false}
55-
src={toggle ? shrinkIcon : expandIcon}
55+
src={expanded ? shrinkIcon : expandIcon}
5656
/>
57-
{toggle ? 'Shrink' : 'Expand'}
57+
{expanded ? 'Shrink' : 'Expand'}
5858
</div>
5959
<div
6060
className={styles.removeButton}
@@ -123,13 +123,13 @@ ImageStep.propTypes = {
123123
title: PropTypes.node.isRequired
124124
};
125125

126-
const NextPrevButtons = ({isRtl, onNextStep, onPrevStep, toggle}) => (
126+
const NextPrevButtons = ({isRtl, onNextStep, onPrevStep, expanded}) => (
127127
<Fragment>
128128
{onNextStep ? (
129129
<div>
130-
<div className={toggle ? (isRtl ? styles.leftCard : styles.rightCard) : styles.hidden} />
130+
<div className={expanded ? (isRtl ? styles.leftCard : styles.rightCard) : styles.hidden} />
131131
<div
132-
className={toggle ? (isRtl ? styles.leftButton : styles.rightButton) : styles.hidden}
132+
className={expanded ? (isRtl ? styles.leftButton : styles.rightButton) : styles.hidden}
133133
onClick={onNextStep}
134134
>
135135
<img
@@ -141,9 +141,9 @@ const NextPrevButtons = ({isRtl, onNextStep, onPrevStep, toggle}) => (
141141
) : null}
142142
{onPrevStep ? (
143143
<div>
144-
<div className={toggle ? (isRtl ? styles.rightCard : styles.leftCard) : styles.hidden} />
144+
<div className={expanded ? (isRtl ? styles.rightCard : styles.leftCard) : styles.hidden} />
145145
<div
146-
className={toggle ? (isRtl ? styles.rightButton : styles.leftButton) : styles.hidden}
146+
className={expanded ? (isRtl ? styles.rightButton : styles.leftButton) : styles.hidden}
147147
onClick={onPrevStep}
148148
>
149149
<img
@@ -157,17 +157,17 @@ const NextPrevButtons = ({isRtl, onNextStep, onPrevStep, toggle}) => (
157157
);
158158

159159
NextPrevButtons.propTypes = {
160+
expanded: PropTypes.bool.isRequired,
160161
isRtl: PropTypes.bool,
161162
onNextStep: PropTypes.func,
162-
onPrevStep: PropTypes.func,
163-
toggle: PropTypes.bool.isRequired
163+
onPrevStep: PropTypes.func
164164
};
165165
CardHeader.propTypes = {
166+
expanded: PropTypes.bool.isRequired,
166167
onCloseCards: PropTypes.func.isRequired,
167168
onShowAll: PropTypes.func.isRequired,
168-
onToggleCards: PropTypes.func.isRequired,
169+
onShrinkExpandCards: PropTypes.func.isRequired,
169170
step: PropTypes.number,
170-
toggle: PropTypes.bool.isRequired,
171171
totalSteps: PropTypes.number
172172
};
173173

@@ -238,15 +238,15 @@ const Cards = props => {
238238
locale,
239239
onActivateDeckFactory,
240240
onCloseCards,
241-
onToggleCards,
241+
onShrinkExpandCards,
242242
onDrag,
243243
onStartDrag,
244244
onEndDrag,
245245
onShowAll,
246246
onNextStep,
247247
onPrevStep,
248248
step,
249-
toggle,
249+
expanded,
250250
...posProps
251251
} = props;
252252
let {x, y} = posProps;
@@ -276,14 +276,14 @@ const Cards = props => {
276276
<div className={styles.cardContainer}>
277277
<div className={styles.card}>
278278
<CardHeader
279+
expanded={expanded}
279280
step={step}
280-
toggle={toggle}
281281
totalSteps={steps.length}
282282
onCloseCards={onCloseCards}
283283
onShowAll={onShowAll}
284-
onToggleCards={onToggleCards}
284+
onShrinkExpandCards={onShrinkExpandCards}
285285
/>
286-
<div className={toggle ? styles.stepBody : styles.hidden}>
286+
<div className={expanded ? styles.stepBody : styles.hidden}>
287287
{steps[step].deckIds ? (
288288
<PreviewsStep
289289
content={content}
@@ -307,8 +307,8 @@ const Cards = props => {
307307
{steps[step].trackingPixel && steps[step].trackingPixel}
308308
</div>
309309
<NextPrevButtons
310+
expanded={expanded}
310311
isRtl={isRtl}
311-
toggle={toggle}
312312
onNextStep={step < steps.length - 1 ? onNextStep : null}
313313
onPrevStep={step > 0 ? onPrevStep : null}
314314
/>
@@ -333,6 +333,7 @@ Cards.propTypes = {
333333
})
334334
}),
335335
dragging: PropTypes.bool.isRequired,
336+
expanded: PropTypes.bool.isRequired,
336337
isRtl: PropTypes.bool.isRequired,
337338
locale: PropTypes.string.isRequired,
338339
onActivateDeckFactory: PropTypes.func.isRequired,
@@ -342,10 +343,9 @@ Cards.propTypes = {
342343
onNextStep: PropTypes.func.isRequired,
343344
onPrevStep: PropTypes.func.isRequired,
344345
onShowAll: PropTypes.func,
346+
onShrinkExpandCards: PropTypes.func.isRequired,
345347
onStartDrag: PropTypes.func,
346-
onToggleCards: PropTypes.func.isRequired,
347348
step: PropTypes.number.isRequired,
348-
toggle: PropTypes.bool.isRequired,
349349
x: PropTypes.number,
350350
y: PropTypes.number
351351
};

src/containers/cards.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React from 'react';
55
import {
66
activateDeck,
77
closeCards,
8-
toggleCards,
8+
shrinkExpandCards,
99
nextStep,
1010
prevStep,
1111
dragCard,
@@ -47,7 +47,7 @@ const mapStateToProps = state => ({
4747
content: state.scratchGui.cards.content,
4848
activeDeckId: state.scratchGui.cards.activeDeckId,
4949
step: state.scratchGui.cards.step,
50-
toggle: state.scratchGui.cards.toggle,
50+
expanded: state.scratchGui.cards.expanded,
5151
x: state.scratchGui.cards.x,
5252
y: state.scratchGui.cards.y,
5353
isRtl: state.locales.isRtl,
@@ -62,7 +62,7 @@ const mapDispatchToProps = dispatch => ({
6262
dispatch(closeCards());
6363
},
6464
onCloseCards: () => dispatch(closeCards()),
65-
onToggleCards: () => dispatch(toggleCards()),
65+
onShrinkExpandCards: () => dispatch(shrinkExpandCards()),
6666
onNextStep: () => dispatch(nextStep()),
6767
onPrevStep: () => dispatch(prevStep()),
6868
onDrag: (e_, data) => dispatch(dragCard(data.x, data.y)),

src/reducers/cards.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import analytics from '../lib/analytics';
33
import decks from '../lib/libraries/decks/index.jsx';
44

55
const CLOSE_CARDS = 'scratch-gui/cards/CLOSE_CARDS';
6-
const TOGGLE_CARDS = 'scratch-gui/cards/TOGGLE_CARDS';
6+
const SHRINK_EXPAND_CARDS = 'scratch-gui/cards/SHRINK_EXPAND_CARDS';
77
const VIEW_CARDS = 'scratch-gui/cards/VIEW_CARDS';
88
const ACTIVATE_DECK = 'scratch-gui/cards/ACTIVATE_DECK';
99
const NEXT_STEP = 'scratch-gui/cards/NEXT_STEP';
@@ -19,7 +19,7 @@ const initialState = {
1919
step: 0,
2020
x: 0,
2121
y: 0,
22-
toggle: true,
22+
expanded: true,
2323
dragging: false
2424
};
2525

@@ -30,9 +30,9 @@ const reducer = function (state, action) {
3030
return Object.assign({}, state, {
3131
visible: false
3232
});
33-
case TOGGLE_CARDS:
33+
case SHRINK_EXPAND_CARDS:
3434
return Object.assign({}, state, {
35-
toggle: !state.toggle // TODO: make clearer
35+
expanded: !state.expanded
3636
});
3737
case VIEW_CARDS:
3838
return Object.assign({}, state, {
@@ -98,8 +98,8 @@ const closeCards = function () {
9898
return {type: CLOSE_CARDS};
9999
};
100100

101-
const toggleCards = function () {
102-
return {type: TOGGLE_CARDS};
101+
const shrinkExpandCards = function () {
102+
return {type: SHRINK_EXPAND_CARDS};
103103
};
104104

105105
const nextStep = function () {
@@ -128,7 +128,7 @@ export {
128128
activateDeck,
129129
viewCards,
130130
closeCards,
131-
toggleCards,
131+
shrinkExpandCards,
132132
nextStep,
133133
prevStep,
134134
dragCard,

src/reducers/gui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const initTutorialCard = function (currentState, deckId) {
107107
visible: true,
108108
content: decks,
109109
activeDeckId: deckId,
110-
toggle: true,
110+
expanded: true,
111111
step: 0,
112112
x: 0,
113113
y: 0,

0 commit comments

Comments
 (0)