malliaridis commented on code in PR #2605: URL: https://github.com/apache/solr/pull/2605#discussion_r1708102341
########## solr/compose-ui/src/commonMain/kotlin/org/apache/solr/composeui/ui/main/MainContent.kt: ########## @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.composeui.ui.main + +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.arkivanov.decompose.extensions.compose.stack.Children +import com.arkivanov.decompose.extensions.compose.subscribeAsState +import org.apache.solr.composeui.components.main.MainComponent +import org.apache.solr.composeui.components.main.integration.asMainMenu +import org.apache.solr.composeui.ui.environment.EnvironmentContent +import org.apache.solr.composeui.ui.logging.LoggingContent +import org.apache.solr.composeui.ui.navigation.NavigationSideBar + +/** + * The composable used for users that have already authenticated. + * + * @param component Component that manages the state of the composable. + */ +@Composable +fun MainContent( + component: MainComponent, + modifier: Modifier = Modifier, +) { + val childStack by component.childStack.subscribeAsState() + val scrollState = rememberScrollState() + + Row(modifier = modifier) { + NavigationSideBar( + modifier = Modifier.fillMaxHeight() + .width(224.dp), + selectedItem = childStack.active.instance.asMainMenu, + onNavigate = component::onNavigate, + ) + + Children( + stack = component.childStack, + modifier = Modifier.weight(1f), + ) { + when(val child = it.instance) { + is MainComponent.Child.Environment -> EnvironmentContent( + component = child.component, + modifier = Modifier.fillMaxWidth() + .verticalScroll(scrollState) + .padding(16.dp), Review Comment: The Figma designs I created in advance follow the 8 point grid system (multiples of 8) that is a common practice for choosing spacings and dimensions. There are many blog posts that explain various benefits of this system, [The power of the 8pt grid system in design](https://medium.com/@mertyagci/the-power-of-the-8pt-grid-system-in-design-1c9dbc683ad8) and [everything you should know about 8 point grid system in UI design](https://uxplanet.org/everything-you-should-know-about-8-point-grid-system-in-ux-design-b69cb945b18d) are just two of them. I mostly follow the guidelines from [Material 3](https://m3.material.io/) too. [Information about spacing](https://m3.material.io/foundations/layout/understanding-layout/spacing) and other stuff can be found in the guidelines. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
