Skip to content

Commit d4e3170

Browse files
committed
[BOOK-475] feat: LoginTooltipBox 구성
기존 CustomTooltipBox -> RecordTooltipBox로 네이밍 변경
1 parent 194d574 commit d4e3170

5 files changed

Lines changed: 107 additions & 7 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package com.ninecraft.booket.feature.login.component
2+
3+
import androidx.annotation.StringRes
4+
import androidx.compose.foundation.background
5+
import androidx.compose.foundation.layout.Box
6+
import androidx.compose.foundation.layout.Column
7+
import androidx.compose.foundation.layout.height
8+
import androidx.compose.foundation.layout.offset
9+
import androidx.compose.foundation.layout.padding
10+
import androidx.compose.foundation.layout.width
11+
import androidx.compose.foundation.shape.RoundedCornerShape
12+
import androidx.compose.material3.Text
13+
import androidx.compose.runtime.Composable
14+
import androidx.compose.ui.Alignment
15+
import androidx.compose.ui.Modifier
16+
import androidx.compose.ui.draw.clip
17+
import androidx.compose.ui.draw.shadow
18+
import androidx.compose.ui.geometry.Size
19+
import androidx.compose.ui.graphics.Outline
20+
import androidx.compose.ui.graphics.Path
21+
import androidx.compose.ui.graphics.Shape
22+
import androidx.compose.ui.graphics.graphicsLayer
23+
import androidx.compose.ui.res.stringResource
24+
import androidx.compose.ui.unit.Density
25+
import androidx.compose.ui.unit.IntOffset
26+
import androidx.compose.ui.unit.LayoutDirection
27+
import androidx.compose.ui.unit.dp
28+
import com.ninecraft.booket.core.designsystem.ComponentPreview
29+
import com.ninecraft.booket.core.designsystem.theme.ReedTheme
30+
import com.ninecraft.booket.feature.login.R
31+
32+
private val TriangleShape = object : Shape {
33+
override fun createOutline(
34+
size: Size,
35+
layoutDirection: LayoutDirection,
36+
density: Density,
37+
): Outline {
38+
val path = Path().apply {
39+
// 왼쪽 위
40+
moveTo(0f, 0f)
41+
// 오른쪽 위
42+
lineTo(size.width, 0f)
43+
// 중앙 아래 (뾰족한 부분)
44+
lineTo(size.width / 2, size.height)
45+
// 닫기
46+
close()
47+
}
48+
return Outline.Generic(path)
49+
}
50+
}
51+
52+
@Composable
53+
internal fun LoginTooltipBox(
54+
@StringRes messageResId: Int,
55+
) {
56+
Column(horizontalAlignment = Alignment.Start) {
57+
Box(
58+
Modifier
59+
.shadow(ReedTheme.radius.xs, RoundedCornerShape(ReedTheme.radius.xs), clip = false)
60+
.clip(RoundedCornerShape(ReedTheme.radius.xs))
61+
.background(ReedTheme.colors.contentBrand)
62+
.padding(
63+
horizontal = ReedTheme.spacing.spacing3,
64+
vertical = ReedTheme.spacing.spacing2,
65+
),
66+
) {
67+
Text(
68+
text = stringResource(messageResId),
69+
color = ReedTheme.colors.contentInverse,
70+
style = ReedTheme.typography.label2Regular,
71+
)
72+
}
73+
Box(
74+
Modifier
75+
.width(ReedTheme.spacing.spacing3)
76+
.height(ReedTheme.spacing.spacing3 / 2)
77+
.offset {
78+
IntOffset(
79+
x = 14.dp.roundToPx(),
80+
y = 0,
81+
)
82+
}
83+
.graphicsLayer {
84+
shadowElevation = 8.dp.toPx()
85+
shape = TriangleShape
86+
clip = true
87+
}
88+
.background(ReedTheme.colors.contentBrand),
89+
)
90+
}
91+
}
92+
93+
@ComponentPreview
94+
@Composable
95+
private fun RecordTooltipBoxPreview() {
96+
ReedTheme {
97+
LoginTooltipBox(messageResId = R.string.recent_login)
98+
}
99+
}

feature/login/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<string name="terms_agreement_all">약관 전체 동의</string>
77
<string name="terms_agreement_button_start">시작하기</string>
88
<string name="guest_login">회원가입 없이 둘러보기</string>
9+
<string name="recent_login">최근 로그인</string>
910
<string-array name="terms_agreement_items">
1011
<item>(필수)서비스 이용약관</item>
1112
<item>(필수)개인정보처리방침</item>

feature/record/src/main/kotlin/com/ninecraft/booket/feature/record/component/CustomTooltipBox.kt renamed to feature/record/src/main/kotlin/com/ninecraft/booket/feature/record/component/RecordTooltipBox.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import com.ninecraft.booket.core.designsystem.theme.ReedTheme
2323
import com.ninecraft.booket.feature.record.R
2424

2525
@Composable
26-
internal fun CustomTooltipBox(
26+
internal fun RecordTooltipBox(
2727
@StringRes messageResId: Int,
2828
) {
2929
Row(verticalAlignment = Alignment.CenterVertically) {
@@ -65,8 +65,8 @@ internal fun CustomTooltipBox(
6565

6666
@ComponentPreview
6767
@Composable
68-
private fun CustomTooltipBoxPreview() {
68+
private fun RecordTooltipBoxPreview() {
6969
ReedTheme {
70-
CustomTooltipBox(messageResId = R.string.scan_tooltip_message)
70+
RecordTooltipBox(messageResId = R.string.scan_tooltip_message)
7171
}
7272
}

feature/record/src/main/kotlin/com/ninecraft/booket/feature/record/step/ImpressionStep.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import com.ninecraft.booket.core.designsystem.component.textfield.ReedRecordText
5151
import com.ninecraft.booket.core.designsystem.theme.ReedTheme
5252
import com.ninecraft.booket.core.designsystem.theme.White
5353
import com.ninecraft.booket.feature.record.R
54-
import com.ninecraft.booket.feature.record.component.CustomTooltipBox
54+
import com.ninecraft.booket.feature.record.component.RecordTooltipBox
5555
import com.ninecraft.booket.feature.record.component.ImpressionGuideBottomSheet
5656
import com.ninecraft.booket.feature.record.register.RecordRegisterUiEvent
5757
import com.ninecraft.booket.feature.record.register.RecordRegisterUiState
@@ -156,7 +156,7 @@ fun ImpressionStep(
156156
verticalAlignment = Alignment.CenterVertically,
157157
) {
158158
if (state.isImpressionGuideTooltipVisible) {
159-
CustomTooltipBox(
159+
RecordTooltipBox(
160160
messageResId = R.string.impression_guide_tooltip_message,
161161
)
162162
}

feature/record/src/main/kotlin/com/ninecraft/booket/feature/record/step/QuoteStep.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import com.ninecraft.booket.core.designsystem.component.textfield.digitOnlyInput
4545
import com.ninecraft.booket.core.designsystem.theme.ReedTheme
4646
import com.ninecraft.booket.core.designsystem.theme.White
4747
import com.ninecraft.booket.feature.record.R
48-
import com.ninecraft.booket.feature.record.component.CustomTooltipBox
48+
import com.ninecraft.booket.feature.record.component.RecordTooltipBox
4949
import com.ninecraft.booket.feature.record.register.RecordRegisterUiEvent
5050
import com.ninecraft.booket.feature.record.register.RecordRegisterUiState
5151
import com.skydoves.compose.stability.runtime.TraceRecomposition
@@ -145,7 +145,7 @@ internal fun QuoteStep(
145145
verticalAlignment = Alignment.CenterVertically,
146146
) {
147147
if (state.isScanTooltipVisible) {
148-
CustomTooltipBox(messageResId = R.string.scan_tooltip_message)
148+
RecordTooltipBox(messageResId = R.string.scan_tooltip_message)
149149
}
150150

151151
ReedButton(

0 commit comments

Comments
 (0)