Skip to content
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

QuackTextStyle 의 align 기본값을 Start 로 변경 #288

Merged
merged 7 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion quackquack-version/ui-components.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
major=1
minor=2
patch=3
patch=4
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ public class QuackSquircle : Shape {
public override fun createOutline(
size: Size,
layoutDirection: LayoutDirection,
density: Density
density: Density,
): Outline.Generic = Outline.Generic(
path = createSquirclePath(size, SMOOTHING)
)

private fun createSquirclePath(size: Size, smoothing: Double): androidx.compose.ui.graphics.Path {
private fun createSquirclePath(
size: Size,
smoothing: Double,
): androidx.compose.ui.graphics.Path {
return Path().apply {
val oversize = size.width * OVERSAMPLING_MULTIPLIER
val squircleRadius = (oversize / 2F).toInt()
Expand Down Expand Up @@ -78,4 +81,4 @@ public class QuackSquircle : Shape {
private const val SMOOTHING = 3.0
private const val OVERSAMPLING_MULTIPLIER = 4F
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
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.DpSize
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -418,7 +419,10 @@ private fun QuackBasicButton(
paddingValues = textPadding,
),
text = text,
style = textStyle,
style = textStyle.change(
textAlign = TextAlign.Center, // 버튼은 항상 Center 를 요구함
),
singleLine = true, // 버튼은 항상 SingleLine 을 요구함
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public fun QuackLargeIconRoundCard(
icon: QuackIcon,
onClick: () -> Unit,
iconSize: DpSize = QuackCardIconSize,
){
) {
QuackIconRoundCard(
size = QuackLargeIconCardSize,
icon = icon,
Expand All @@ -279,7 +279,7 @@ public fun QuackSmallIconRoundCard(
icon: QuackIcon,
onClick: () -> Unit,
iconSize: DpSize = QuackCardIconSize,
){
) {
QuackIconRoundCard(
size = QuackSmallIconCardSize,
icon = icon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ public fun QuackDropDown(
onClick: () -> Unit,
) {
Row(
modifier = Modifier.clip(
modifier = Modifier
.clip(
shape = QuackDropDownShape,
).border(
)
.border(
border = QuackBorder(
color = Gray3,
).asComposeBorder(),
shape = QuackDropDownShape,
).quackClickable {
)
.quackClickable {
onClick()
}.background(
}
.background(
color = QuackColor.White.composeColor,
).padding(
)
.padding(
paddingValues = QuackDropDownPadding,
),
horizontalArrangement = Arrangement.spacedBy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import kotlinx.collections.immutable.PersistentList
Expand Down Expand Up @@ -290,9 +289,7 @@ public fun QuackMenuFab(
end = QuackFabMenuHorizontalPadding,
),
text = item.text,
style = QuackFabMenuItemTextStyle.change(
textAlign = TextAlign.Start,
),
style = QuackFabMenuItemTextStyle,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package team.duckie.quackquack.ui.component

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.grid.GridCells
Expand Down Expand Up @@ -100,7 +99,7 @@ public fun <T> QuackHeaderGridLayout(
itemContent: @Composable (Int, T) -> Unit,
header: @Composable () -> Unit,
) {
if ( items.isEmpty()) return
if (items.isEmpty()) return
val gridItems = listOf(items[0]) + items

LazyVerticalGrid(
Expand Down Expand Up @@ -156,7 +155,7 @@ public fun <T> QuackFooterGridLayout(
itemContent: @Composable (Int, T) -> Unit,
footer: @Composable () -> Unit,
) {
if ( items.isEmpty()) return
if (items.isEmpty()) return
val gridItems = items + items[0]

LazyVerticalGrid(
Expand Down Expand Up @@ -211,7 +210,7 @@ private fun QuackSimpleGridItem(
footer: (@Composable () -> Unit)? = null,
onClickFooter: (() -> Unit)? = null,
header: (@Composable () -> Unit)? = null,
onClickHeader: ( () -> Unit)? = null,
onClickHeader: (() -> Unit)? = null,
) {
Box(
modifier = Modifier
Expand All @@ -221,7 +220,8 @@ private fun QuackSimpleGridItem(
horizontal = horizontalSpace,
vertical = verticalSpace,
)
).quackClickable(
)
.quackClickable(
onClick = onClickFooter ?: onClickHeader,
rippleEnabled = true,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
package team.duckie.quackquack.ui.component

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.paint
Expand All @@ -32,7 +27,6 @@ import team.duckie.quackquack.ui.animation.AnimatedContentTransform
import team.duckie.quackquack.ui.border.QuackSquircle
import team.duckie.quackquack.ui.color.QuackColor
import team.duckie.quackquack.ui.color.animateQuackColorAsState
import team.duckie.quackquack.ui.constant.NoPadding
import team.duckie.quackquack.ui.icon.QuackIcon
import team.duckie.quackquack.ui.modifier.quackClickable
import team.duckie.quackquack.ui.util.runIf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public fun QuackTag(
true,
)
),
singleLine = true,
)
}

Expand Down Expand Up @@ -188,6 +189,7 @@ public fun QuackGrayscaleTag(
style = QuackTextStyle.Title2.change(
weight = FontWeight.Normal,
),
singleLine = true,
)
if (trailingText.isNotEmpty()) {
QuackText(
Expand All @@ -201,6 +203,7 @@ public fun QuackGrayscaleTag(
weight = FontWeight.Bold,
color = QuackColor.DuckieOrange,
),
singleLine = true,
)
}
}
Expand Down Expand Up @@ -261,6 +264,7 @@ private fun QuackIconTagInternal(
type = QuackTagType.Icon,
onClick = onClick,
),
verticalAlignment = Alignment.CenterVertically,
) {
QuackText(
modifier = Modifier.wrapContentSize(),
Expand All @@ -273,6 +277,7 @@ private fun QuackIconTagInternal(
false,
),
),
singleLine = true,
)
QuackImageInternal(
modifier = Modifier
Expand Down Expand Up @@ -358,6 +363,7 @@ public fun QuackRowTag(
),
text = title,
style = QuackTextStyle.Title2,
singleLine = true,
)
}
}
Expand Down Expand Up @@ -430,6 +436,7 @@ private fun QuackRowTagItem(
true,
),
),
singleLine = true,
)
}

Expand Down Expand Up @@ -483,6 +490,7 @@ public fun QuackSingleRowTag(
),
text = title,
style = QuackTextStyle.Title2,
singleLine = true,
)
}
LazyRow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import team.duckie.quackquack.ui.animation.QuackAnimationSpec
Expand Down Expand Up @@ -78,12 +77,10 @@ private val QuackBorderTextAreaTextStyle: (
true -> QuackTextStyle.Subtitle2.change(
color = QuackColor.Gray2,
weight = FontWeight.Normal,
textAlign = TextAlign.Start,
)
else -> QuackTextStyle.Subtitle2.change(
color = QuackColor.Black,
weight = FontWeight.Normal,
textAlign = TextAlign.Start,
)
}
}
Expand All @@ -102,12 +99,10 @@ private val QuackTextAreaTextStyle: (
true -> QuackTextStyle.Subtitle.change(
color = QuackColor.Gray2,
weight = FontWeight.Normal,
textAlign = TextAlign.Start,
)
else -> QuackTextStyle.Subtitle.change(
color = QuackColor.Black,
weight = FontWeight.Normal,
textAlign = TextAlign.Start,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
Expand Down Expand Up @@ -338,7 +337,6 @@ internal fun QuackBasicTextField(
key2 = isPlaceholder,
) {
textStyle.change(
textAlign = TextAlign.Start,
color = QuackTextFieldColors.textColor(
isPlaceholder = isPlaceholder,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public fun QuackIconTextToggle(
)
QuackBody2(
text = text,
singleLine = true,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class QuackTextStyle internal constructor(
public val weight: FontWeight,
public val letterSpacing: TextUnit,
public val lineHeight: TextUnit,
public val textAlign: TextAlign = TextAlign.Center,
public val textAlign: TextAlign = TextAlign.Start,
) {
@Stable
private val suit = FontFamily(Font(R.font.quack_suit_variable))
Expand Down
Loading