@@ -19,11 +19,12 @@ import androidx.compose.foundation.Image
1919import androidx.compose.foundation.background
2020import androidx.compose.foundation.clickable
2121import androidx.compose.foundation.isSystemInDarkTheme
22+ import androidx.compose.foundation.layout.Arrangement
2223import androidx.compose.foundation.layout.Box
2324import androidx.compose.foundation.layout.Column
2425import androidx.compose.foundation.layout.Row
2526import androidx.compose.foundation.layout.Spacer
26- import androidx.compose.foundation.layout.fillMaxSize
27+ import androidx.compose.foundation.layout.fillMaxWidth
2728import androidx.compose.foundation.layout.padding
2829import androidx.compose.foundation.layout.size
2930import androidx.compose.foundation.layout.width
@@ -71,7 +72,7 @@ fun MenuPanelRowView(
7172 ) {
7273 Row (
7374 modifier = Modifier
74- .fillMaxSize ()
75+ .fillMaxWidth ()
7576 .padding(HmrcTheme .dimensions.hmrcSpacing16),
7677 verticalAlignment = Alignment .CenterVertically ,
7778 ) {
@@ -86,7 +87,7 @@ fun MenuPanelRowView(
8687 modifier = Modifier .semantics {
8788 contentDescription =
8889 if (body.isNullOrBlank()) heading + buttonAccessibility else " "
89- }
90+ }.weight(weight = 0.8f , fill = false )
9091 )
9192
9293 Spacer (modifier = Modifier .padding(HmrcTheme .dimensions.hmrcSpacing4))
@@ -101,7 +102,7 @@ fun MenuPanelRowView(
101102 .background(
102103 color = HmrcTheme .colors.hmrcRed,
103104 shape = RoundedCornerShape (size = HmrcTheme .dimensions.hmrcSpacing32)
104- ),
105+ ).weight(weight = 0.2f , fill = false ) ,
105106 contentAlignment = Alignment .Center
106107 ) {
107108 if (notification != null ) {
@@ -145,59 +146,44 @@ fun MenuPanelRowView(
145146@Composable
146147fun MenuPanelRowViewPreview () {
147148 HmrcTheme {
148- MenuPanelRowView (
149- heading = " Heading" ,
150- onClick = {}
151- )
152- }
153- }
149+ Column (verticalArrangement = Arrangement .spacedBy(HmrcTheme .dimensions.hmrcSpacing8)) {
150+ MenuPanelRowView (
151+ heading = " Heading" ,
152+ onClick = {}
153+ )
154154
155- @Preview
156- @Composable
157- fun MenuPanelRowViewExternalPreview () {
158- HmrcTheme {
159- MenuPanelRowView (
160- heading = " Heading" ,
161- onClick = {},
162- icon = R .drawable.ic_open_in_external_browser,
163- accessibilityDescription = R .string.accessibility_button_open_in_browser
164- )
165- }
166- }
155+ MenuPanelRowView (
156+ heading = " Heading" ,
157+ onClick = {},
158+ icon = R .drawable.ic_open_in_external_browser,
159+ accessibilityDescription = R .string.accessibility_button_open_in_browser
160+ )
167161
168- @Preview
169- @Composable
170- fun MenuPanelRowViewBodyPreview () {
171- HmrcTheme {
172- MenuPanelRowView (
173- heading = " Heading" ,
174- onClick = {},
175- body = " Body"
176- )
177- }
178- }
162+ MenuPanelRowView (
163+ heading = " Heading" ,
164+ onClick = {},
165+ body = " Body"
166+ )
179167
180- @Preview
181- @Composable
182- fun MenuPanelRowViewNotificationPreview () {
183- HmrcTheme {
184- MenuPanelRowView (
185- heading = " Heading" ,
186- onClick = {},
187- hasNotification = true
188- )
189- }
190- }
168+ MenuPanelRowView (
169+ heading = " Heading" ,
170+ onClick = {},
171+ hasNotification = true
172+ )
191173
192- @Preview
193- @Composable
194- fun MenuPanelRowViewNotificationsPreview () {
195- HmrcTheme {
196- MenuPanelRowView (
197- heading = " Heading" ,
198- onClick = {},
199- hasNotification = true ,
200- notification = " 2"
201- )
174+ MenuPanelRowView (
175+ heading = " Heading Heading Heading" ,
176+ onClick = {},
177+ hasNotification = true ,
178+ notification = " 9"
179+ )
180+
181+ MenuPanelRowView (
182+ heading = " Heading Heading Heading Heading Heading Heading" ,
183+ onClick = {},
184+ hasNotification = true ,
185+ notification = " 999"
186+ )
187+ }
202188 }
203189}
0 commit comments