-
Notifications
You must be signed in to change notification settings - Fork 1
Login Screens + Design System #6
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
Changes from all commits
e84b41c
010c21a
7d0ba95
3027800
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| package com.cornellappdev.hustle.ui.components.onboarding | ||
|
|
||
| import androidx.compose.animation.animateContentSize | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.PaddingValues | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.material3.Button | ||
| import androidx.compose.material3.ButtonDefaults | ||
| import androidx.compose.material3.CircularProgressIndicator | ||
| 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.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.cornellappdev.hustle.ui.theme.HustleColors | ||
| import com.cornellappdev.hustle.ui.theme.HustleSpacing | ||
| import com.cornellappdev.hustle.ui.theme.HustleTheme | ||
|
|
||
| @Composable | ||
| fun SignInButton( | ||
| onClick: () -> Unit, | ||
| modifier: Modifier = Modifier, | ||
| isLoading: Boolean = false | ||
| ) { | ||
| Button( | ||
| onClick = onClick, | ||
| enabled = !isLoading, | ||
| modifier = modifier.fillMaxWidth(), | ||
| colors = ButtonDefaults.buttonColors( | ||
| containerColor = HustleColors.accentGreen, | ||
| contentColor = HustleColors.hustleGreen, | ||
| disabledContainerColor = HustleColors.accentGreen, | ||
| disabledContentColor = HustleColors.hustleGreen | ||
| ), | ||
| contentPadding = PaddingValues( | ||
| vertical = HustleSpacing.medium | ||
| ), | ||
| shape = RoundedCornerShape(15.dp) | ||
| ) { | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| horizontalArrangement = Arrangement.spacedBy(HustleSpacing.small), | ||
| modifier = Modifier.animateContentSize() | ||
| ) { | ||
| if (isLoading) { | ||
| CircularProgressIndicator( | ||
| color = HustleColors.hustleGreen, | ||
| modifier = Modifier.size(24.dp) | ||
| ) | ||
| } | ||
| Text( | ||
| text = if (isLoading) "Signing in..." else "Log in with NetID", | ||
| style = MaterialTheme.typography.titleLarge | ||
| ) | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| private fun SignInButtonPreview() { | ||
| HustleTheme(dynamicColor = false) { | ||
| SignInButton(onClick = {}, isLoading = true) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,19 +1,38 @@ | ||||||
| package com.cornellappdev.hustle.ui.screens.onboarding | ||||||
|
|
||||||
| import androidx.compose.foundation.background | ||||||
| import androidx.compose.foundation.layout.Arrangement | ||||||
| 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.material3.Icon | ||||||
| import androidx.compose.material3.MaterialTheme | ||||||
| import androidx.compose.material3.Text | ||||||
| import androidx.compose.runtime.Composable | ||||||
| import androidx.compose.runtime.LaunchedEffect | ||||||
| import androidx.compose.ui.Alignment | ||||||
| import androidx.compose.ui.Modifier | ||||||
| import androidx.compose.ui.graphics.Color | ||||||
| import androidx.compose.ui.res.painterResource | ||||||
| import androidx.compose.ui.text.SpanStyle | ||||||
| import androidx.compose.ui.text.buildAnnotatedString | ||||||
| import androidx.compose.ui.text.font.FontStyle | ||||||
| import androidx.compose.ui.text.font.FontWeight | ||||||
| import androidx.compose.ui.text.withStyle | ||||||
| import androidx.compose.ui.tooling.preview.Preview | ||||||
| import androidx.compose.ui.tooling.preview.PreviewParameter | ||||||
| import androidx.compose.ui.tooling.preview.PreviewParameterProvider | ||||||
| import androidx.compose.ui.unit.dp | ||||||
| import androidx.compose.ui.unit.sp | ||||||
| import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel | ||||||
| import com.cornellappdev.hustle.R | ||||||
| import com.cornellappdev.hustle.ui.components.general.ErrorMessage | ||||||
| import com.cornellappdev.hustle.ui.components.onboarding.GoogleSignInButton | ||||||
| import com.cornellappdev.hustle.ui.components.onboarding.SignInButton | ||||||
| import com.cornellappdev.hustle.ui.theme.HustleColors | ||||||
| import com.cornellappdev.hustle.ui.theme.HustleSpacing | ||||||
| import com.cornellappdev.hustle.ui.theme.HustleTheme | ||||||
| import com.cornellappdev.hustle.ui.theme.InstrumentSans | ||||||
| import com.cornellappdev.hustle.ui.viewmodels.ActionState | ||||||
| import com.cornellappdev.hustle.ui.viewmodels.onboarding.SignInScreenViewModel | ||||||
|
|
||||||
|
|
@@ -49,13 +68,23 @@ private fun SignInScreenContent( | |||||
| onDismissError: () -> Unit, | ||||||
| modifier: Modifier = Modifier, | ||||||
| ) { | ||||||
| Box(modifier = modifier.fillMaxSize()) { | ||||||
| Box( | ||||||
| modifier = modifier | ||||||
| .fillMaxSize() | ||||||
| .background(HustleColors.hustleGreen) | ||||||
| .padding( | ||||||
| horizontal = HustleSpacing.leftRightMargin | ||||||
| ) | ||||||
| ) { | ||||||
| Column( | ||||||
| horizontalAlignment = Alignment.CenterHorizontally, | ||||||
| verticalArrangement = Arrangement.Center, | ||||||
| verticalArrangement = Arrangement.spacedBy( | ||||||
| 89.dp, alignment = Alignment.CenterVertically | ||||||
|
||||||
| 89.dp, alignment = Alignment.CenterVertically | |
| HustleSpacing.signInScreenVerticalSpacing, alignment = Alignment.CenterVertically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is unspecified intentional? Why is it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Compose tints the icon another color without it, so this makes sure it keeps the original color
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,15 @@ package com.cornellappdev.hustle.ui.theme | |
|
|
||
| import androidx.compose.ui.graphics.Color | ||
|
|
||
| val Purple80 = Color(0xFFD0BCFF) | ||
| val PurpleGrey80 = Color(0xFFCCC2DC) | ||
| val Pink80 = Color(0xFFEFB8C8) | ||
|
|
||
| val Purple40 = Color(0xFF6650a4) | ||
| val PurpleGrey40 = Color(0xFF625b71) | ||
| val Pink40 = Color(0xFF7D5260) | ||
| object HustleColors { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like we should be getting these based on the theme instead, so this way it's easier to support dark theme in the future
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will look into
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the new commit should have this now. I did need to add the dynamicColor = false to the HustleTheme parameters for the colors to apply properly. |
||
| val hustleGreen = Color(0xFF004346) | ||
| val accentGreen = Color(0xFFD5EFB4) | ||
| val primaryBlack = Color(0xFF000000) | ||
| val tertiaryGray = Color(0xFF2D2D2D) | ||
| val secondaryGray = Color(0xFF7D8288) | ||
| val iconInactive = Color(0xFFBEBEBE) | ||
| val stroke = Color(0xFFD6D6D6) | ||
| val wash = Color(0xFFF5F5F5) | ||
| val tint = Color(0xFFB2B3B6) | ||
| val white = Color(0xFFFFFFFF) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.cornellappdev.hustle.ui.theme | ||
|
|
||
| import androidx.compose.ui.unit.dp | ||
|
|
||
| object HustleSpacing { | ||
| val extraSmall = 8.dp | ||
| val small = 12.dp | ||
| val medium = 16.dp | ||
| val large = 24.dp | ||
| val extraLarge = 36.dp | ||
| val huge = 64.dp | ||
|
|
||
| val topMarginBig = huge | ||
| val topMarginNormal = extraLarge | ||
| val leftRightMargin = large | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could we wrap this in
animateContentSizeto make the whole experience a bit cleanerThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will look into
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to the row modifier