Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…N-ANDROID-CGV into UI/#7-seats-screen-components
  • Loading branch information
tunaunnie committed Nov 22, 2024
2 parents 80d9f4d + f62bb23 commit b2dca0f
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package org.sopt.cgv.core.designsystem.component.button

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.sopt.cgv.core.common.extension.noRippleClickable
import org.sopt.cgv.core.designsystem.theme.CGVTheme
import org.sopt.cgv.core.designsystem.theme.Gray500
import org.sopt.cgv.core.designsystem.theme.PrimaryRed400
import org.sopt.cgv.core.designsystem.theme.White

@Composable
fun CgvButton(
modifier: Modifier = Modifier,
text: String,
textStyle: TextStyle = CGVTheme.typography.head3_b_14,
textColor: Color = White,
background: Color = PrimaryRed400,
borderColor: Color = Color.Transparent,
horizontalPadding: Dp = 54.dp,
verticalPadding: Dp = 8.dp,
roundedCornerShape: Dp = 8.dp,
onClick: () -> Unit,
enabled: Boolean = false,
isBack: Boolean = false,
) {
Box(
modifier = modifier
.clip(shape = RoundedCornerShape(roundedCornerShape))
.border(BorderStroke(1.dp, borderColor), RoundedCornerShape(roundedCornerShape))
.background(if (enabled) Gray500 else if (isBack) White else background)
.noRippleClickable { onClick() },
contentAlignment = Alignment.Center
) {
Text(
text = text,
style = textStyle,
color = textColor,
modifier = Modifier.padding(horizontal = horizontalPadding, vertical = verticalPadding)
)
}
}

@Preview
@Composable
private fun CgvButtonPreview() {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
CgvButton(
text = "지금예매",
textStyle = CGVTheme.typography.head3_b_14,
horizontalPadding = 56.dp,
verticalPadding = 8.dp,
onClick = {}
)
CgvButton(
text = "예매",
textStyle = CGVTheme.typography.body1_m_12,
horizontalPadding = 4.dp,
verticalPadding = 3.dp,
roundedCornerShape = 4.dp,
onClick = {}
)
CgvButton(
text = "극장선택",
textStyle = CGVTheme.typography.head6_b_17,
horizontalPadding = 136.dp,
verticalPadding = 16.dp,
roundedCornerShape = 10.dp,
onClick = {}
)
CgvButton(
text = "좌석선택",
textStyle = CGVTheme.typography.head6_b_17,
horizontalPadding = 136.dp,
verticalPadding = 16.dp,
roundedCornerShape = 10.dp,
onClick = {}
)
CgvButton(
text = "좌석선택",
textStyle = CGVTheme.typography.head6_b_17,
horizontalPadding = 48.dp,
verticalPadding = 17.dp,
roundedCornerShape = 12.dp,
onClick = {},
enabled = true
)
CgvButton(
text = "뒤로가기",
textStyle = CGVTheme.typography.head6_b_17,
textColor = PrimaryRed400,
borderColor = PrimaryRed400,
horizontalPadding = 48.dp,
verticalPadding = 17.dp,
roundedCornerShape = 12.dp,
onClick = {},
isBack = true
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.sopt.cgv.R
import org.sopt.cgv.core.designsystem.component.button.CgvButton
import org.sopt.cgv.core.designsystem.theme.Black
import org.sopt.cgv.core.designsystem.theme.CGVTheme
import org.sopt.cgv.core.designsystem.theme.Gray800
Expand Down Expand Up @@ -104,11 +105,12 @@ fun MovieCard(

Spacer(modifier = Modifier.height(8.dp))

ReservationButton(
CgvButton(
text = "지금예매",
horizontalPadding = 54.dp,
verticalPadding = 8.dp,
textStyle = CGVTheme.typography.head3_b_14
textStyle = CGVTheme.typography.head3_b_14,
onClick = {}
)

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.sopt.cgv.R
import org.sopt.cgv.core.designsystem.component.button.CgvButton
import org.sopt.cgv.core.designsystem.theme.CGVTheme
import org.sopt.cgv.core.designsystem.theme.Gray100
import org.sopt.cgv.core.designsystem.theme.Gray700
Expand Down Expand Up @@ -69,11 +70,12 @@ fun MovieSmallCard(
)
}

ReservationButton(
CgvButton(
text = "예매",
horizontalPadding = 4.dp,
verticalPadding = 2.dp,
textStyle = CGVTheme.typography.body1_m_12
textStyle = CGVTheme.typography.body1_m_12,
onClick = {}
)

Spacer(modifier = Modifier.width(8.dp))
Expand Down

This file was deleted.

0 comments on commit b2dca0f

Please sign in to comment.