Skip to content

Commit 39dfafa

Browse files
committed
Move "HiddenOnMobile" up the hierarchy
Update EditCard.spec.tsx.snap
1 parent 9120343 commit 39dfafa

File tree

2 files changed

+96
-88
lines changed

2 files changed

+96
-88
lines changed

src/app/content/highlights/components/EditCard.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,20 @@ function LoginOrEdit({
7676
>
7777
{
7878
authenticated ? (
79-
(props.shouldFocusCard || props.data?.annotation) ? (
80-
<form
81-
ref={mergeRefs(fref, element)}
82-
data-analytics-region='edit-note'
83-
data-highlight-card
84-
>
85-
<ActiveEditCard props={props} element={element} />
86-
</form>
87-
) :
88-
<i>Press Enter or double-click highlight to edit highlight</i>
79+
<HiddenOnMobile>
80+
{
81+
(props.shouldFocusCard || props.data?.annotation) ? (
82+
<form
83+
ref={mergeRefs(fref, element)}
84+
data-analytics-region='edit-note'
85+
data-highlight-card
86+
>
87+
<ActiveEditCard props={props} element={element} />
88+
</form>
89+
) :
90+
<i>Press Enter or double-click highlight to edit highlight</i>
91+
}
92+
</HiddenOnMobile>
8993
) : <LoginConfirmation onBlur={props.onBlur} />
9094
}
9195
</div>
@@ -205,7 +209,7 @@ function ActiveEditCard({
205209
useTrapTabNavigation(ref, editingAnnotation);
206210

207211
return (
208-
<HiddenOnMobile ref={ref}>
212+
<div ref={ref}>
209213
<ColorPicker
210214
color={props.data?.color}
211215
onChange={onColorChange}
@@ -248,7 +252,7 @@ function ActiveEditCard({
248252
always={() => setConfirmingDelete(false)}
249253
/>
250254
)}
251-
</HiddenOnMobile>
255+
</div>
252256
);
253257
}
254258

src/app/content/highlights/components/__snapshots__/EditCard.spec.tsx.snap

Lines changed: 80 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -107,59 +107,61 @@ exports[`EditCard matches snapshot when editing 1`] = `
107107
className="c0"
108108
role="dialog"
109109
>
110-
<form
111-
data-analytics-region="edit-note"
112-
data-highlight-card={true}
110+
<div
111+
className=""
113112
>
114-
<div
115-
className=""
113+
<form
114+
data-analytics-region="edit-note"
115+
data-highlight-card={true}
116116
>
117-
<div
118-
data-props={
119-
Object {
120-
"color": undefined,
121-
"onChange": [Function],
122-
"onRemove": null,
117+
<div>
118+
<div
119+
data-props={
120+
Object {
121+
"color": undefined,
122+
"onChange": [Function],
123+
"onRemove": null,
124+
}
123125
}
124-
}
125-
mock-color-picker="true"
126-
/>
127-
<div
128-
data-props={
129-
Object {
130-
"edit": false,
131-
"note": "asdf",
132-
"onChange": [Function],
133-
"onFocus": [Function],
134-
"textareaRef": Object {
135-
"current": null,
136-
},
126+
mock-color-picker="true"
127+
/>
128+
<div
129+
data-props={
130+
Object {
131+
"edit": false,
132+
"note": "asdf",
133+
"onChange": [Function],
134+
"onFocus": [Function],
135+
"textareaRef": Object {
136+
"current": null,
137+
},
138+
}
137139
}
138-
}
139-
mock-note="true"
140-
/>
141-
<div
142-
className="c1 c2"
143-
>
144-
<button
145-
className="c3"
146-
data-analytics-label="save"
147-
data-testid="save"
148-
onClick={[Function]}
149-
>
150-
Save
151-
</button>
152-
<button
153-
className="c4"
154-
data-analytics-label="cancel"
155-
data-testid="cancel"
156-
onClick={[Function]}
140+
mock-note="true"
141+
/>
142+
<div
143+
className="c1 c2"
157144
>
158-
Cancel
159-
</button>
145+
<button
146+
className="c3"
147+
data-analytics-label="save"
148+
data-testid="save"
149+
onClick={[Function]}
150+
>
151+
Save
152+
</button>
153+
<button
154+
className="c4"
155+
data-analytics-label="cancel"
156+
data-testid="cancel"
157+
onClick={[Function]}
158+
>
159+
Cancel
160+
</button>
161+
</div>
160162
</div>
161-
</div>
162-
</form>
163+
</form>
164+
</div>
163165
</div>
164166
`;
165167

@@ -218,39 +220,41 @@ exports[`EditCard matches snapshot with data 1`] = `
218220
className="c0"
219221
role="dialog"
220222
>
221-
<form
222-
data-analytics-region="edit-note"
223-
data-highlight-card={true}
223+
<div
224+
className=""
224225
>
225-
<div
226-
className=""
226+
<form
227+
data-analytics-region="edit-note"
228+
data-highlight-card={true}
227229
>
228-
<div
229-
data-props={
230-
Object {
231-
"color": undefined,
232-
"onChange": [Function],
233-
"onRemove": null,
230+
<div>
231+
<div
232+
data-props={
233+
Object {
234+
"color": undefined,
235+
"onChange": [Function],
236+
"onRemove": null,
237+
}
234238
}
235-
}
236-
mock-color-picker="true"
237-
/>
238-
<div
239-
data-props={
240-
Object {
241-
"edit": false,
242-
"note": "",
243-
"onChange": [Function],
244-
"onFocus": [Function],
245-
"textareaRef": Object {
246-
"current": null,
247-
},
239+
mock-color-picker="true"
240+
/>
241+
<div
242+
data-props={
243+
Object {
244+
"edit": false,
245+
"note": "",
246+
"onChange": [Function],
247+
"onFocus": [Function],
248+
"textareaRef": Object {
249+
"current": null,
250+
},
251+
}
248252
}
249-
}
250-
mock-note="true"
251-
/>
252-
</div>
253-
</form>
253+
mock-note="true"
254+
/>
255+
</div>
256+
</form>
257+
</div>
254258
</div>
255259
`;
256260

0 commit comments

Comments
 (0)