-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/#11 designsystem inputtext #12
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
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fbb3ef3
rename/#11: ColorScheme์ Light ๋ค์ด๋ฐ ์ ๊ฑฐ
jinukeu f97e69c
remove/#11: ์ฌ์ฉํ์ง ์๋ ํ
์คํธ ์ฝ๋ ์ ๊ฑฐ
jinukeu 2ab70e5
feat/#11: InputTextDefaults ๋ฐ ๊ด๋ จ ๋ฐ์ดํฐ ํด๋์ค ์ ์
jinukeu 681dbfd
feat/#11: YappInputTextBasic, Large ๊ตฌํ
jinukeu efeab1e
refactor/#11: YappInputText Token(shape, textStyles ...)์ ํ๋ผ๋ฏธํฐ๋ก ๋ฐ์ ์ โฆ
jinukeu 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
148 changes: 148 additions & 0 deletions
148
...nsystem/src/main/java/com/yapp/core/designsystem/component/inputtext/InputTextDefaults.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,148 @@ | ||
package com.yapp.core.designsystem.component.inputtext | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Immutable | ||
import androidx.compose.runtime.Stable | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import com.yapp.core.designsystem.theme.YappTheme | ||
|
||
@Immutable | ||
object InputTextDefaults { | ||
val shapeLarge = RoundedCornerShape(10.dp) | ||
val shapeMedium = RoundedCornerShape(8.dp) | ||
|
||
val colors | ||
@Composable | ||
get() = InputTextColors( | ||
labelColor = YappTheme.colorScheme.labelAlternative, | ||
|
||
defaultInputTextColor = YappTheme.colorScheme.labelNormal.copy(alpha = 0.16f), | ||
activeInputTextColor = YappTheme.colorScheme.labelNormal, | ||
errorInputTextColor = YappTheme.colorScheme.statusNegative, | ||
successInputTextColor = YappTheme.colorScheme.labelNormal, | ||
|
||
defaultDescriptionColor = YappTheme.colorScheme.labelAssistive, | ||
activeDescriptionColor = YappTheme.colorScheme.staticBlack, | ||
errorDescriptionColor = YappTheme.colorScheme.statusNegative, | ||
successDescriptionColor = YappTheme.colorScheme.statusPositive, | ||
|
||
defaultOutlineColor = YappTheme.colorScheme.lineNormalNormal, | ||
activeOutlineColor = YappTheme.colorScheme.primaryNormal, | ||
errorOutlineColor = YappTheme.colorScheme.statusNegative, | ||
successOutlineColor = YappTheme.colorScheme.lineNormalStrong, | ||
) | ||
|
||
val textStylesLarge | ||
@Composable | ||
get() = InputTextTextStyles( | ||
labelTextStyle = YappTheme.typography.label1Normal, | ||
inputTextTextStyle = YappTheme.typography.body1Normal, | ||
descriptionTextStyle = YappTheme.typography.label2, | ||
) | ||
|
||
val textStylesMedium | ||
@Composable | ||
get() = InputTextTextStyles( | ||
labelTextStyle = YappTheme.typography.label1Normal, | ||
inputTextTextStyle = YappTheme.typography.body2Normal, | ||
descriptionTextStyle = YappTheme.typography.label2, | ||
) | ||
|
||
val spacingsLarge = InputTextSpacings( | ||
labelBottomSpacing = 4.dp, | ||
rightIconStartSpacing = 12.dp, | ||
descriptionTopSpacing = 8.dp, | ||
) | ||
|
||
// TODO ์์ง ์ ์๋์ง ์์ | ||
val spacingsMedium = InputTextSpacings( | ||
labelBottomSpacing = Dp.Unspecified, | ||
rightIconStartSpacing = Dp.Unspecified, | ||
descriptionTopSpacing = Dp.Unspecified, | ||
) | ||
|
||
val contentPaddingsLarge = PaddingValues(vertical = 12.dp, horizontal = 16.dp) | ||
val contentPaddingsMedium = PaddingValues(vertical = 8.dp, horizontal = 10.dp) | ||
|
||
val rightIconSizeLarge = 24.dp | ||
// TODO ์์ง ์ ์๋์ง ์์ | ||
val rightIconSizeMedium = Dp.Unspecified | ||
} | ||
|
||
@Immutable | ||
data class InputTextColors( | ||
val labelColor: Color, | ||
|
||
val defaultInputTextColor: Color, | ||
val activeInputTextColor: Color, | ||
val errorInputTextColor: Color, | ||
val successInputTextColor: Color, | ||
|
||
val defaultDescriptionColor: Color, | ||
val activeDescriptionColor: Color, | ||
val errorDescriptionColor: Color, | ||
val successDescriptionColor: Color, | ||
|
||
val defaultOutlineColor: Color, | ||
val activeOutlineColor: Color, | ||
val errorOutlineColor: Color, | ||
val successOutlineColor: Color, | ||
) { | ||
@Stable | ||
internal fun inputTextColor( | ||
value: String, | ||
isError: Boolean, | ||
focused: Boolean, | ||
): Color = | ||
when { | ||
isError -> errorInputTextColor | ||
value.isNotEmpty() && focused.not() -> successInputTextColor | ||
focused -> activeInputTextColor | ||
else -> successInputTextColor | ||
} | ||
|
||
@Stable | ||
internal fun descriptionColor( | ||
value: String, | ||
isError: Boolean, | ||
focused: Boolean, | ||
): Color = | ||
when { | ||
isError -> errorDescriptionColor | ||
value.isNotEmpty() && focused.not() -> successDescriptionColor | ||
focused -> activeDescriptionColor | ||
else -> defaultDescriptionColor | ||
} | ||
|
||
@Stable | ||
internal fun outlineColor( | ||
value: String, | ||
isError: Boolean, | ||
focused: Boolean, | ||
): Color = | ||
when { | ||
isError -> errorOutlineColor | ||
value.isNotEmpty() && focused.not() -> successOutlineColor | ||
focused -> activeOutlineColor | ||
else -> defaultOutlineColor | ||
} | ||
} | ||
|
||
@Immutable | ||
data class InputTextSpacings( | ||
val labelBottomSpacing: Dp, | ||
val rightIconStartSpacing: Dp, | ||
val descriptionTopSpacing: Dp, | ||
) | ||
|
||
@Immutable | ||
data class InputTextTextStyles( | ||
val labelTextStyle: TextStyle, | ||
val inputTextTextStyle: TextStyle, | ||
val descriptionTextStyle: TextStyle, | ||
) |
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.
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.
@immutable @stable
๋ ๊ฐ๊ฐ ์๋ฏธ๊ฐ ๋น์ทํ ๊ฒ ๊ฐ์๋ฐ ๋๋ ์ ์ฐ์ ์ด์ ๊ฐ ์์๊น์ ?!
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.
InputTextColors์ ํ๋ฒ ๊ฐ์ด ์์ฑ๋๋ฉด ๋ถ๋ณํ๋ฏ๋ก Immutable์, inputTextColor์ ์ํ์ ๋ฐ๋ผ ๊ฐ์ด ๋ณ๊ฒฝ๋๋ฏ๋ก Stable์ ์ฌ์ฉํ์ต๋๋ค!
https://velog.io/@skydoves/compose-stability