-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update onboarding flow with the new designs (#381)
* Update onboarding flow with the new designs * Created Welcome Screen * Redesigned Login Screen * Added error indicators and text errors for Login input fields * Run spotless
- Loading branch information
1 parent
ab58d50
commit 0da8c6f
Showing
14 changed files
with
449 additions
and
54 deletions.
There are no files selected for viewing
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
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
82 changes: 82 additions & 0 deletions
82
anystream-client-ui/src/commonMain/kotlin/anystream/ui/components/PrimaryButton.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,82 @@ | ||
/** | ||
* AnyStream | ||
* Copyright (C) 2023 AnyStream Maintainers | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package anystream.ui.components | ||
|
||
import androidx.compose.animation.AnimatedContent | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material.Button | ||
import androidx.compose.material.ButtonDefaults | ||
import androidx.compose.material.CircularProgressIndicator | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
internal fun PrimaryButton( | ||
leftIcon: @Composable (() -> Unit)? = null, | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
isLoading: Boolean = false, | ||
onClick: () -> Unit, | ||
) { | ||
Button( | ||
onClick = onClick, | ||
shape = CircleShape, | ||
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 18.dp), | ||
enabled = !isLoading, | ||
colors = ButtonDefaults.buttonColors( | ||
contentColor = MaterialTheme.colors.onBackground, | ||
disabledBackgroundColor = MaterialTheme.colors.primary, | ||
), | ||
modifier = modifier, | ||
) { | ||
AnimatedContent(targetState = isLoading) { targetState -> | ||
when (targetState) { | ||
true -> { | ||
CircularProgressIndicator( | ||
modifier = Modifier.size(20.dp), | ||
color = MaterialTheme.colors.onBackground, | ||
strokeWidth = 1.dp, | ||
) | ||
} | ||
|
||
false -> { | ||
leftIcon?.let { icon -> | ||
icon() | ||
Spacer(Modifier.width(8.dp)) | ||
} | ||
Text( | ||
text = text, | ||
style = MaterialTheme.typography.body1.copy(fontWeight = FontWeight.Bold), | ||
letterSpacing = 0.2.sp, | ||
textAlign = TextAlign.Center, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.