-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19983 from wordpress-mobile/feature/19802-designs…
…ystem Add entry point for Design System
- Loading branch information
Showing
8 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+63.1 MB
WordPress/jetpackJalapeno/release/org.wordpress.android-jetpack-jalapeno-release.aab
Binary file not shown.
This file contains 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
31 changes: 31 additions & 0 deletions
31
WordPress/src/main/java/org/wordpress/android/designsystem/DesignSystemActivity.kt
This file contains 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,31 @@ | ||
package org.wordpress.android.designsystem | ||
|
||
import android.content.res.Configuration | ||
import android.os.Bundle | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import org.wordpress.android.ui.LocaleAwareActivity | ||
import org.wordpress.android.util.extensions.setContent | ||
|
||
class DesignSystemActivity : LocaleAwareActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
DesignSystem() | ||
} | ||
} | ||
|
||
@Preview(name = "Light Mode") | ||
@Preview( | ||
uiMode = Configuration.UI_MODE_NIGHT_YES, | ||
showBackground = true, | ||
name = "Dark Mode" | ||
) | ||
|
||
@Composable | ||
fun PreviewDesignSystemActivity() { | ||
DesignSystem() | ||
} | ||
} | ||
|
||
|
10 changes: 10 additions & 0 deletions
10
WordPress/src/main/java/org/wordpress/android/designsystem/DesignSystemDataSource.kt
This file contains 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,10 @@ | ||
package org.wordpress.android.designsystem | ||
|
||
import org.wordpress.android.R | ||
|
||
object DesignSystemDataSource { | ||
val buttonOptions = listOf( | ||
R.string.design_system_foundation, | ||
R.string.design_system_components | ||
) | ||
} |
86 changes: 86 additions & 0 deletions
86
WordPress/src/main/java/org/wordpress/android/designsystem/DesignSystemScreen.kt
This file contains 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,86 @@ | ||
package org.wordpress.android.designsystem | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.widthIn | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.dimensionResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.wordpress.android.R | ||
import org.wordpress.android.designsystem.DesignSystemDataSource.buttonOptions | ||
|
||
enum class DesignSystemScreen { | ||
Start | ||
} | ||
@Composable | ||
fun DesignSystemStartScreen( | ||
modifier: Modifier = Modifier | ||
){ | ||
Column( | ||
modifier = modifier, | ||
verticalArrangement = Arrangement.SpaceBetween | ||
) { | ||
Row(modifier = Modifier.weight(1f, false)) { | ||
Column( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy( | ||
dimensionResource(id = R.dimen.button_container_shadow_height) | ||
) | ||
) { | ||
buttonOptions.forEach { item -> | ||
SelectOptionButton( | ||
labelResourceId = item, | ||
onClick = {} | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun SelectOptionButton( | ||
@StringRes labelResourceId: Int, | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier | ||
){ | ||
Button( | ||
onClick = onClick, | ||
modifier = modifier.widthIn(min = 250.dp), | ||
colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.primary) | ||
) { | ||
Text(stringResource(labelResourceId)) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun StartDesignSystemPreview() { | ||
DesignSystemStartScreen( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(dimensionResource(R.dimen.button_container_shadow_height)) | ||
) | ||
} | ||
@Composable | ||
fun DesignSystem() { | ||
DesignSystemStartScreen( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(dimensionResource(R.dimen.button_container_shadow_height)) | ||
) | ||
} |
This file contains 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 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 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