Skip to content

Commit 29a1adc

Browse files
create-issue-branch[bot]loiswells97patch0
authored
Fix MZ spacing problems (#191)
# What's Changed? - Moved the fourth column of the Astro Pi control panel to underneath - Increased the spacing between the roll, pitch and yaw values ## Review app https://staging-editor.raspberrypi.org/branches/issues_190-Fix_MZ_spacing_problems/web-component.html?sense_hat_always_enabled=t ## Screenshots ### Before <img width="900" alt="Screenshot 2022-09-21 at 15 54 24" src="https://user-images.githubusercontent.com/88904316/191538317-69592bf4-8042-4b49-8476-d56b5632af1b.png"> ### After <img width="897" alt="Screenshot 2022-09-21 at 15 55 52" src="https://user-images.githubusercontent.com/88904316/191538493-14471508-965b-4c9a-a9e8-d8c8a7658fa0.png"> ## What's not changed? - Making the web component responsive (would need to be relative to the width of its container on the host page rather than purely the page width, maybe using container queries?) closes #190 Co-authored-by: loiswells97 <loiswells97@users.noreply.github.com> Co-authored-by: Lois Wells <lois.wells@raspberrypi.org> Co-authored-by: Patrick Cherry <patch0@users.noreply.github.com> Co-authored-by: Lois Wells <88904316+loiswells97@users.noreply.github.com>
1 parent bc59bfa commit 29a1adc

3 files changed

Lines changed: 32 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1313

1414
### Changed
1515

16+
- Layout and spacing in the Mission Zero Control Panel so web component fits in a narrower container (#191)
1617
- Updated modal styling (#193)
1718

1819
## [0.4.0]

src/components/AstroPiModel/AstroPiControls/AstroPiControls.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ const AstroPiControls = (props) => {
1313
<div className='sense-hat-controls'>
1414
<h2 className='sense-hat-controls-heading'>Space Station Control Panel</h2>
1515
<div className="sense-hat-controls-panel">
16+
<div className='sense-hat-controls-panel__sliders'>
1617
<SliderInput name="temperature" unit="°C" min={-40} max={120} defaultValue={temperature} Icon={TemperatureIcon} />
1718
<SliderInput name="pressure" unit="hPa" min={260} max={1260} defaultValue={pressure} Icon={PressureIcon}/>
1819
<SliderInput name="humidity" unit="%" min={0} max={100} defaultValue={humidity} Icon={HumidityIcon}/>
20+
</div>
1921

20-
<div className="sense-hat-controls-panel__control">
21-
<Input name="colour" label="Colour Picker" type="color" defaultValue={colour} />
22+
<div className="sense-hat-controls-panel__control sense-hat-controls-panel__control-last">
23+
<Input name="colour" label="Colour" type="color" defaultValue={colour} />
2224
<MotionInput defaultValue={motion} />
2325
<Stopwatch />
2426
</div>

src/components/AstroPiModel/AstroPiModel.scss

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@
3030
}
3131

3232
&__values {
33-
flex: 8;
33+
flex: 10;
3434
display: flex;
35-
margin: 0 var(--spacing-6);
35+
margin: 0 var(--spacing-1);
3636
}
3737

3838
&__reading {
3939
flex: 1;
4040
text-transform: uppercase;
4141
font-weight: var(--font-weight-bold);
42-
margin: 0 var(--spacing-2);
42+
margin: 0 var(--spacing-1);
4343
font-size: var(--font-size-d-1);
4444
}
4545

@@ -74,7 +74,7 @@
7474
&-panel {
7575
flex: 1;
7676
display: flex;
77-
justify-content: space-between;
77+
flex-flow: column;
7878

7979
&__control {
8080
display: flex;
@@ -85,7 +85,7 @@
8585
padding-top: var(--spacing-half);
8686
box-sizing: border-box;
8787
border-radius: 5px;
88-
width: 24%;
88+
width: 32%;
8989
justify-content: space-between;
9090

9191
&-reading {
@@ -110,7 +110,7 @@
110110
&-toggle {
111111
border-radius: 5px;
112112
width: 100%;
113-
padding: var(--spacing-half);
113+
flex: 1;
114114
box-sizing: border-box;
115115
display: flex;
116116
align-items: center;
@@ -123,12 +123,15 @@
123123

124124
&-input {
125125
cursor: pointer;
126-
width: 115px;
126+
width: 85px;
127127
transform: rotate(270deg);
128128
}
129129

130130
input[type='color'] {
131131
border-radius: 5px;
132+
flex: 1;
133+
width: 100%;
134+
padding: var(--spacing-half) var(--spacing-2);
132135
}
133136

134137
&-name {
@@ -140,13 +143,29 @@
140143
&-value {
141144
margin-left: var(--spacing-half);
142145
}
146+
147+
&-last {
148+
margin-top: var(--spacing-1);
149+
flex-flow: row;
150+
width: 100%;
151+
align-items: inherit;
152+
justify-content: space-between;
153+
}
154+
}
155+
156+
&__sliders {
157+
display: flex;
158+
justify-content: space-between;
159+
.sense-hat-controls-panel__control {
160+
min-height: 175px;
161+
}
143162
}
144163

145164
&__container {
146165
display: flex;
147166
flex-flow: column;
148167
align-items: center;
149-
width: 100%;
168+
width: 32%;
150169

151170
.sense-hat-controls-panel__control-name, input {
152171
cursor: pointer;

0 commit comments

Comments
 (0)