-
-
Notifications
You must be signed in to change notification settings - Fork 0
Components part1 #662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Components part1 #662
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
1184ff7
feat(ui): components interfaces
comfrt1k 1265115
feat(common): storybook resources
comfrt1k b3d1916
feat(app): storybook sidebar
comfrt1k b8ddfe8
feat(app): storybook component
comfrt1k c54afd8
refactor(common): extract storybook to separate module
comfrt1k 08ab910
refactor(storybook): module structure
comfrt1k 5820544
feat(theme): button component
comfrt1k d66e606
feat(common): storybook resources
comfrt1k 2680693
feat(app): storybook sidebar
comfrt1k ab697e4
feat(app): storybook component
comfrt1k a01e1dc
refactor(common): extract storybook to separate module
comfrt1k 11b4d5c
refactor(storybook): module structure
comfrt1k 82fac57
Merge branch 'feat/theme' into feat/components-part1
comfrt1k 23d8f2d
refactor(button): state as enum
comfrt1k 415356a
refactor(button): appearance colors
comfrt1k 4f64103
feat(button): story
comfrt1k 88ac576
feat(theme): spacers
comfrt1k ce06810
chore(theme): remove unused elevation
comfrt1k 7d81277
chore(theme): none border stroke
comfrt1k 858508f
feat(button): styles
comfrt1k 4ee53d9
feat(ui): card component with styles
comfrt1k 6f5b8d3
feat(ui): avatar styles
comfrt1k c85acc4
feat(ui): avatar component
comfrt1k a5ee798
feat(ui): checkbox styles
comfrt1k 2b2e863
feat(ui): checkbox state
comfrt1k 97d3091
feat(ui): checkbox component with story
comfrt1k 3673050
feat(ui): divider styles
comfrt1k 234b4e4
feat(ui): divider components
comfrt1k 142f51b
refactor(ui): border token
comfrt1k 38f3193
feat(ui): weight token
comfrt1k 1f46487
feat(ui): icon primitive
comfrt1k c7ac81b
feat(ui): image components
comfrt1k 3bd2482
feat(ui): link components
comfrt1k eaef57b
feat(ui): text component
comfrt1k d04a833
feat(theme): checkbox and image sizes
comfrt1k bc06816
feat(common): ktor engine deps
comfrt1k ee9b93f
refactor(common): use theme transparent color
comfrt1k 5644f2a
chore(sample): new components story usage
comfrt1k 306cc8c
Merge branch 'master' into feat/components-part1
comfrt1k 438c709
feat(ui): input styles
comfrt1k 0d651ef
feat(ui): input locals
comfrt1k 25c5786
feat(ui): input component
comfrt1k 4fa29c2
feat(theme): alpha tokens
comfrt1k 2a026a3
feat(ui): switch styles
comfrt1k 3888d58
feat(ui): switch component
comfrt1k 44202f0
feat(ui): column layouts
comfrt1k c4b5734
feat(ui): grid layout
comfrt1k 43b1966
feat(ui): row layout
comfrt1k e2a437e
feat(ui): date picker week days
comfrt1k f0c73fd
feat(ui): calendar header component
comfrt1k 0bdfe49
feat(ui): date picker day component
comfrt1k 202bf44
chore(theme): aspect square util
comfrt1k 9987ce9
chore(theme): icon sizes
comfrt1k 7e9c5ce
feat(ui): date picker components
comfrt1k 12d5782
feat(ui): date picker fragment
comfrt1k be56069
feat(ui): date picker model
comfrt1k 27c19d8
feat(ui): date utils
comfrt1k 22f485a
chore(ui): date picker constants
comfrt1k b49d542
feat(ui): date picker styles
comfrt1k 6b25b13
feat(ui): chevron icons
comfrt1k 278ef5f
feat(theme): draghandle sizes
comfrt1k 210881a
chore(theme): new elevation token
comfrt1k e681594
refactor(ui): rename divider files
comfrt1k 55eae6d
feat(ui): drag handle component
comfrt1k a04a68b
feat(ui): modal styles
comfrt1k f813368
feat(ui): modal components with stories
comfrt1k 90c4ea2
feat(ui): date picker stories
comfrt1k 66b844c
feat(ui): date/calendar deps
comfrt1k 6633cda
chore(storybook): spacing for component variants
comfrt1k 5bbdcc5
chore(deps): toml update
comfrt1k 3834a64
feat(app): new stories usage
comfrt1k bf306c3
Merge branch 'feat/components-part1' into feat/components-part2
comfrt1k fe5a744
chore(input): remove todo
comfrt1k ccfaeb8
Merge remote-tracking branch 'origin/feat/components-part2' into feat…
comfrt1k 2a99091
refactor(ui): move sizes from theme
comfrt1k c56b203
Merge branch 'feat/components-part1' into feat/components-part2
comfrt1k 3c881b1
refactor(ui): move alpha from colors to effects
comfrt1k beea202
refactor(theme): move component sizes to components
comfrt1k 7150f6d
refactor(theme): move elevation tokens to layout
comfrt1k 2c20615
refactor(picker): split styles
comfrt1k 0737e78
Merge pull request #663
TorinAsakura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 31 additions & 12 deletions
43
mobile/kmp/sample/src/commonMain/kotlin/com/atls/hyperion/sample/App.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,41 @@ | ||
| package com.atls.hyperion.sample | ||
|
|
||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.material.MaterialTheme | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.unit.dp | ||
| import com.atls.hyperion.storybook.fragments.storybook.Storybook | ||
| import com.atls.hyperion.ui.components.avatar.stories.AvatarStory | ||
| import com.atls.hyperion.ui.components.button.stories.ButtonStory | ||
| import com.atls.hyperion.ui.components.card.stories.CardStory | ||
| import com.atls.hyperion.ui.components.checkbox.stories.CheckboxStory | ||
| import com.atls.hyperion.ui.components.divider.stories.DividerStory | ||
| import com.atls.hyperion.ui.components.input.stories.InputStory | ||
| import com.atls.hyperion.ui.components.modal.bottom.stories.BottomDialogStory | ||
| import com.atls.hyperion.ui.components.modal.popup.stories.PopupStory | ||
| import com.atls.hyperion.ui.components.switch.stories.SwitchStory | ||
| import com.atls.hyperion.ui.fragment.datepicker.stories.DatePickerStory | ||
| import com.atls.hyperion.ui.fragment.datepicker.stories.DateRangePickerStory | ||
| import com.atls.hyperion.ui.primitives.stories.LinkStory | ||
| import com.atls.hyperion.ui.primitives.stories.TextStory | ||
|
|
||
| @Composable | ||
| fun App() { | ||
| MaterialTheme { | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .padding(16.dp) | ||
| ) { | ||
| //TODO use for demonstration and tests | ||
| } | ||
| Storybook( | ||
| components = listOf( | ||
| AvatarStory(), | ||
| BottomDialogStory(), | ||
| ButtonStory(), | ||
| CheckboxStory(), | ||
| DatePickerStory(), | ||
| DateRangePickerStory(), | ||
| DividerStory(), | ||
| InputStory(), | ||
| PopupStory(), | ||
| SwitchStory(), | ||
| CardStory(), | ||
| TextStory(), | ||
| LinkStory() | ||
| ) | ||
| ) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
|
||
| plugins { | ||
| alias(libs.plugins.kotlinMultiplatform) | ||
| alias(libs.plugins.androidLibrary) | ||
| alias(libs.plugins.composeMultiplatform) | ||
| alias(libs.plugins.composeCompiler) | ||
| } | ||
|
|
||
| group = "com.atls.hyperion" | ||
| version = "0.1.0" | ||
|
|
||
| kotlin { | ||
| androidTarget { | ||
| compilerOptions { | ||
| jvmTarget.set(JvmTarget.JVM_21) | ||
| } | ||
| } | ||
|
|
||
| listOf( | ||
| iosX64(), | ||
| iosArm64(), | ||
| iosSimulatorArm64() | ||
| ).forEach { iosTarget -> | ||
| iosTarget.binaries.framework { | ||
| baseName = "storybook" | ||
| isStatic = true | ||
| } | ||
| } | ||
|
|
||
| sourceSets { | ||
| commonMain.dependencies { | ||
| implementation(compose.runtime) | ||
| implementation(compose.foundation) | ||
| implementation(compose.material) | ||
| implementation(compose.ui) | ||
| implementation(compose.components.resources) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| compose.resources { | ||
| publicResClass = false | ||
| generateResClass = auto | ||
| } | ||
|
|
||
| android { | ||
| namespace = "com.atls.hyperion.storybook" | ||
|
|
||
| val compileSdkValue = System.getenv(Versions.COMPILE_SDK_KEY)?.toInt() | ||
| ?: (extra[Versions.COMPILE_SDK_KEY] as String).toInt() | ||
| val minSdkValue = System.getenv(Versions.MIN_SDK_KEY)?.toInt() | ||
| ?: (extra[Versions.MIN_SDK_KEY] as String).toInt() | ||
| val javaTargetValue = System.getenv(Versions.JAVA_TARGET_KEY)?.toInt() | ||
| ?: (extra[Versions.JAVA_TARGET_KEY] as String).toInt() | ||
|
|
||
| compileSdk = compileSdkValue | ||
| defaultConfig { | ||
| minSdk = minSdkValue | ||
| } | ||
| compileOptions { | ||
| sourceCompatibility = JavaVersion.toVersion(javaTargetValue) | ||
| targetCompatibility = JavaVersion.toVersion(javaTargetValue) | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
mobile/kmp/storybook/src/commonMain/composeResources/drawable/menu.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
|
||
| <path android:fillColor="#00000000" android:pathData="M4,17H20M4,12H20M4,7H20" android:strokeColor="#000000" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="1.5"/> | ||
|
|
||
| </vector> | ||
5 changes: 5 additions & 0 deletions
5
mobile/kmp/storybook/src/commonMain/composeResources/values/strings.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <resources> | ||
| <string name="components">Components</string> | ||
| <string name="select_component_from_sidebar">Select a component from the sidebar</string> | ||
| <string name="toggle_sidebar">Toggle Sidebar</string> | ||
| </resources> |
5 changes: 5 additions & 0 deletions
5
mobile/kmp/storybook/src/commonMain/kotlin/com/atls/hyperion/storybook/config/Constants.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.atls.hyperion.storybook.config | ||
|
|
||
| import androidx.compose.ui.unit.dp | ||
|
|
||
| internal val sidebarWidth = 250.dp |
90 changes: 90 additions & 0 deletions
90
...rybook/src/commonMain/kotlin/com/atls/hyperion/storybook/fragments/storybook/Storybook.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| package com.atls.hyperion.storybook.fragments.storybook | ||
|
|
||
| import androidx.compose.animation.AnimatedVisibility | ||
| import androidx.compose.animation.slideInHorizontally | ||
| import androidx.compose.animation.slideOutHorizontally | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.safeDrawingPadding | ||
| import androidx.compose.material.Icon | ||
| import androidx.compose.material.IconButton | ||
| import androidx.compose.material.MaterialTheme | ||
| import androidx.compose.material.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import com.atls.hyperion.storybook.fragments.storybook.ui.Sidebar | ||
| import com.atls.hyperion.storybook.generated.resources.Res | ||
| import com.atls.hyperion.storybook.generated.resources.menu | ||
| import com.atls.hyperion.storybook.generated.resources.select_component_from_sidebar | ||
| import com.atls.hyperion.storybook.generated.resources.toggle_sidebar | ||
| import com.atls.hyperion.storybook.shared.model.ComponentExample | ||
| import com.atls.hyperion.storybook.shared.ui.theme.Padding | ||
| import org.jetbrains.compose.resources.painterResource | ||
| import org.jetbrains.compose.resources.stringResource | ||
|
|
||
| @Composable | ||
| fun Storybook( | ||
| components: List<ComponentExample> | ||
| ) { | ||
| var isSidebarVisible by remember { mutableStateOf(false) } | ||
| var selectedComponent by remember(components) { | ||
| mutableStateOf(components.firstOrNull()) | ||
| } | ||
|
|
||
| Box { | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .safeDrawingPadding() | ||
| ) { | ||
| IconButton( | ||
| onClick = { isSidebarVisible = !isSidebarVisible }, | ||
| modifier = Modifier | ||
| .padding(Padding.small) | ||
| ) { | ||
| Icon( | ||
| painter = painterResource(Res.drawable.menu), | ||
| contentDescription = stringResource(Res.string.toggle_sidebar), | ||
| tint = MaterialTheme.colors.onSurface | ||
| ) | ||
| } | ||
| Box( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| ) { | ||
| if (selectedComponent != null) { | ||
| selectedComponent?.Content() | ||
| } else { | ||
| Text( | ||
| text = stringResource(Res.string.select_component_from_sidebar), | ||
| modifier = Modifier | ||
| .align(Alignment.Center), | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| AnimatedVisibility( | ||
| visible = isSidebarVisible, | ||
| enter = slideInHorizontally(), | ||
| exit = slideOutHorizontally() | ||
| ) { | ||
| Sidebar( | ||
| components = components, | ||
| selectedComponent = selectedComponent, | ||
| onComponentClick = { component -> | ||
| selectedComponent = component | ||
| isSidebarVisible = false | ||
| }, | ||
| onClose = { isSidebarVisible = false } | ||
| ) | ||
| } | ||
| } | ||
| } |
74 changes: 74 additions & 0 deletions
74
...ybook/src/commonMain/kotlin/com/atls/hyperion/storybook/fragments/storybook/ui/Sidebar.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| package com.atls.hyperion.storybook.fragments.storybook.ui | ||
|
|
||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxHeight | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.lazy.LazyColumn | ||
| import androidx.compose.foundation.lazy.items | ||
| import androidx.compose.material.Divider | ||
| import androidx.compose.material.MaterialTheme | ||
| import androidx.compose.material.Surface | ||
| import androidx.compose.material.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.text.font.FontWeight | ||
| import com.atls.hyperion.storybook.config.sidebarWidth | ||
| import com.atls.hyperion.storybook.generated.resources.Res | ||
| import com.atls.hyperion.storybook.generated.resources.components | ||
| import com.atls.hyperion.storybook.shared.model.ComponentExample | ||
| import com.atls.hyperion.storybook.shared.ui.theme.FontSize | ||
| import com.atls.hyperion.storybook.shared.ui.theme.Padding | ||
| import org.jetbrains.compose.resources.stringResource | ||
|
|
||
| @Composable | ||
| fun Sidebar( | ||
| components: List<ComponentExample>, | ||
| selectedComponent: ComponentExample?, | ||
| onComponentClick: (ComponentExample) -> Unit, | ||
| onClose: () -> Unit | ||
| ) { | ||
| Box( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .clickable { onClose() } | ||
| ) { | ||
| Surface( | ||
| modifier = Modifier | ||
| .fillMaxHeight() | ||
| .width(sidebarWidth), | ||
| color = MaterialTheme.colors.surface | ||
| ) { | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .padding(Padding.medium) | ||
| ) { | ||
| Text( | ||
| text = stringResource(Res.string.components), | ||
| fontSize = FontSize.large, | ||
| fontWeight = FontWeight.Bold, | ||
| modifier = Modifier.padding(vertical = Padding.large) | ||
| ) | ||
| LazyColumn { | ||
| items(components) { component -> | ||
| Text( | ||
| text = component.name, | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .clickable { onComponentClick(component) } | ||
| .padding(vertical = Padding.small), | ||
| fontWeight = if (component == selectedComponent) FontWeight.Bold else FontWeight.Normal, | ||
| fontSize = FontSize.small | ||
| ) | ||
| Divider() | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...rybook/src/commonMain/kotlin/com/atls/hyperion/storybook/shared/model/ComponentExample.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.atls.hyperion.storybook.shared.model | ||
|
|
||
| import androidx.compose.runtime.Composable | ||
|
|
||
| interface ComponentExample { | ||
| val name: String | ||
| @Composable | ||
| fun Content() | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.