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

[FEAT][#5] TopAppBar component 수정 및 에셋 추가 #30

Merged
merged 3 commits into from
Feb 5, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_setting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M21.36,12.26C22.12,11.83 22.47,10.93 22.2,10.1L21.52,8.02C21.25,7.19 20.43,6.67 19.57,6.77L18.64,6.88C18.46,6.66 18.27,6.45 18.08,6.26C17.45,5.63 16.72,5.1 15.92,4.69C15.44,4.44 15.1,3.98 15,3.44C14.83,2.58 14.08,1.97 13.21,1.97H11.03C10.16,1.97 9.41,2.59 9.24,3.44C9.13,3.97 8.81,4.44 8.32,4.68C7.5,5.09 6.76,5.63 6.12,6.28C5.74,6.66 5.19,6.83 4.65,6.77C3.78,6.67 2.97,7.19 2.7,8.02L2.02,10.1C1.75,10.93 2.1,11.83 2.86,12.26C3.33,12.52 3.68,12.98 3.76,13.51C3.9,14.43 4.19,15.29 4.6,16.09C4.85,16.57 4.84,17.15 4.61,17.64C4.25,18.43 4.49,19.37 5.2,19.89L6.97,21.17C7.68,21.68 8.64,21.63 9.29,21.03C9.69,20.66 10.23,20.48 10.76,20.56C11.2,20.63 11.66,20.67 12.12,20.67C12.58,20.67 13.04,20.63 13.48,20.56C14.01,20.47 14.56,20.66 14.95,21.03C15.59,21.62 16.56,21.68 17.27,21.17L19.04,19.89C19.75,19.38 19.99,18.44 19.63,17.65C19.4,17.15 19.4,16.58 19.64,16.1C20.05,15.31 20.34,14.44 20.48,13.52C20.56,12.99 20.89,12.52 21.36,12.26Z"
android:strokeWidth="1.5"
android:fillColor="#00000000"
android:strokeColor="#121212"/>
<path
android:pathData="M12.11,15.5C14.038,15.5 15.6,13.937 15.6,12.009C15.6,10.082 14.038,8.52 12.11,8.52C10.183,8.52 8.62,10.082 8.62,12.009C8.62,13.937 10.183,15.5 12.11,15.5Z"
android:strokeWidth="1.5"
android:fillColor="#00000000"
android:strokeColor="#121212"/>
</vector>
21 changes: 21 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_text_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="43dp"
android:height="23dp"
android:viewportWidth="43"
android:viewportHeight="23">
<path
android:pathData="M0,2.588H2.165V21.695H0V2.588Z"
android:fillColor="#12284D"/>
<path
android:pathData="M3.759,7.276C5.046,6.369 5.715,5.441 5.715,3.963C5.644,3.988 5.573,3.988 5.477,3.988C4.811,3.988 4.167,3.559 4.167,2.723C4.167,1.888 4.716,1.363 5.477,1.363C6.43,1.363 7.026,2.174 7.026,3.606C7.026,5.681 6.073,7.159 4.33,8.207L3.756,7.279L3.759,7.276Z"
android:fillColor="#12284D"/>
<path
android:pathData="M10.425,22.688C9.497,22.688 8.846,22.376 8.476,21.75C8.103,21.124 7.917,20.381 7.917,19.511C7.917,18.524 8.099,17.364 8.463,16.032C8.827,14.703 9.305,13.305 9.901,11.843C10.496,10.382 11.15,8.95 11.865,7.55C12.581,6.15 13.296,4.879 14.012,3.738C14.727,2.6 15.394,1.693 16.007,1.015C16.621,0.339 17.111,0 17.476,0C17.716,0 17.923,0.133 18.095,0.395C18.265,0.657 18.404,0.975 18.503,1.348C18.604,1.721 18.654,2.057 18.654,2.363C18.654,2.908 18.518,3.618 18.247,4.494C17.975,5.37 17.59,6.338 17.096,7.396C16.603,8.454 16.017,9.533 15.341,10.631C14.666,11.729 13.925,12.778 13.118,13.777C12.309,14.776 11.443,15.637 10.517,16.362C10.437,16.865 10.36,17.37 10.289,17.873C10.218,18.376 10.184,18.841 10.184,19.264C10.184,20.01 10.302,20.559 10.533,20.911C10.764,21.263 11.082,21.441 11.486,21.441C12.01,21.441 12.541,21.201 13.074,20.717C13.608,20.233 14.117,19.622 14.601,18.888C15.085,18.151 15.508,17.392 15.872,16.605L16.507,16.969C15.659,18.724 14.721,20.115 13.694,21.142C12.667,22.169 11.578,22.684 10.428,22.684L10.425,22.688ZM10.971,14.764C11.677,14.039 12.34,13.231 12.966,12.346C13.592,11.458 14.172,10.548 14.706,9.607C15.239,8.67 15.708,7.763 16.112,6.884C16.516,6.008 16.828,5.222 17.05,4.525C17.272,3.828 17.392,3.279 17.414,2.878C17.414,2.797 17.392,2.726 17.352,2.665C17.192,2.665 16.923,2.902 16.55,3.374C16.177,3.849 15.742,4.488 15.249,5.296C14.755,6.104 14.246,7.029 13.722,8.078C13.198,9.126 12.695,10.224 12.211,11.375C11.726,12.525 11.313,13.654 10.971,14.761V14.764Z"
android:fillColor="#12284D"/>
<path
android:pathData="M17.506,18.104C17.506,15.023 20.195,13.512 26.25,12.833C26.274,10.927 25.676,9.049 23.249,9.049C21.552,9.049 20.038,9.857 18.968,10.616L18.107,9.129C19.335,8.321 21.318,7.275 23.588,7.275C27.008,7.275 28.365,9.598 28.365,12.99V21.734H26.617L26.435,20.01H26.358C25,21.157 23.381,22.073 21.608,22.073C19.285,22.073 17.509,20.664 17.509,18.107L17.506,18.104ZM26.25,18.391V14.267C21.265,14.841 19.569,16.041 19.569,17.975C19.569,19.671 20.744,20.349 22.178,20.349C23.613,20.349 24.816,19.671 26.25,18.391Z"
android:fillColor="#12284D"/>
<path
android:pathData="M31.916,20.272H31.863L31.629,21.734H29.957V0.959H32.07V6.726L31.965,9.311C33.297,8.188 34.889,7.275 36.505,7.275C40.184,7.275 42.143,10.119 42.143,14.452C42.143,19.282 39.247,22.073 35.984,22.073C34.679,22.073 33.165,21.395 31.912,20.272H31.916ZM39.928,14.477C39.928,11.294 38.833,9.074 36.014,9.074C34.787,9.074 33.482,9.78 32.073,11.109V18.73C33.377,19.878 34.71,20.269 35.675,20.269C38.127,20.269 39.928,18.052 39.928,14.474V14.477Z"
android:fillColor="#12284D"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import com.nexters.ilab.android.core.designsystem.R
import com.nexters.ilab.android.core.designsystem.theme.Blue900
import com.nexters.ilab.android.core.designsystem.theme.Subtitle1
import com.nexters.ilab.core.ui.ComponentPreview

Expand All @@ -31,6 +32,7 @@ fun ILabTopAppBar(
contentColor: Color = Color.Black,
containerColor: Color = Color.White,
onNavigationClick: () -> Unit = {},
isTextLogo: Boolean = false,
) {
CompositionLocalProvider(LocalContentColor provides contentColor) {
val icon: @Composable (Modifier, imageVector: ImageVector) -> Unit =
Expand Down Expand Up @@ -66,17 +68,35 @@ fun ILabTopAppBar(
)
}

Text(
text = stringResource(id = titleRes),
modifier = Modifier.align(Alignment.Center),
style = Subtitle1,
color = Color.Black,
)
if (navigationType == TopAppBarNavigationType.Setting) {
icon(
Modifier.align(Alignment.CenterEnd),
ImageVector.vectorResource(id = R.drawable.ic_setting),
)
}

if (isTextLogo) {
Icon(
modifier = Modifier
.size(48.dp)
.align(Alignment.CenterStart),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_text_logo),
contentDescription = navigationIconContentDescription,
tint = Blue900,
)
} else {
Text(
text = stringResource(id = titleRes),
modifier = Modifier.align(Alignment.Center),
style = Subtitle1,
color = Color.Black,
)
}
}
}
}

enum class TopAppBarNavigationType { Back, Close }
enum class TopAppBarNavigationType { Back, Close, Setting }

@ComponentPreview
@Composable
Expand All @@ -97,3 +117,14 @@ fun ILabTopAppBarClosePreview() {
navigationIconContentDescription = "Navigation close icon",
)
}

@ComponentPreview
@Composable
fun ILabTopAppBarSettingreview() {
ILabTopAppBar(
titleRes = android.R.string.untitled,
navigationType = TopAppBarNavigationType.Setting,
navigationIconContentDescription = "Navigation Setting icon",
isTextLogo = true,
)
}
Loading