Skip to content

Commit

Permalink
#5 [add] CustomHeader component 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoeunjoo committed Nov 1, 2024
1 parent 5af6128 commit 02b016d
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions app/src/main/java/org/sopt/and/component/CustomHeader.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.sopt.and.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

@Composable
fun CustomHeader(
startIcon: @Composable (() -> Unit)? = null,
centerContent: @Composable () -> Unit,
endIcon: @Composable (() -> Unit)? = null
) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(10.dp)
.background(color = Color(0xFF1B1B1B))
) {
startIcon?.let { icon ->
Box(
modifier = Modifier
.align(Alignment.CenterStart)
.padding(vertical = 16.dp)
) {
icon()
}
}
Box(
modifier = Modifier
.align(Alignment.Center)
) {
centerContent()
}
endIcon?.let { icon ->
Box(
modifier = Modifier
.align(Alignment.CenterEnd)
.padding(vertical = 16.dp)
) {
icon()
}
}
}
}

0 comments on commit 02b016d

Please sign in to comment.