-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3defa78
commit 56a15c2
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyOverview.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.wap.wapp.feature.survey.answer | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.SpanStyle | ||
import androidx.compose.ui.text.buildAnnotatedString | ||
import androidx.compose.ui.text.withStyle | ||
import androidx.compose.ui.unit.dp | ||
import com.wap.designsystem.WappTheme | ||
import com.wap.designsystem.component.WappButton | ||
import com.wap.designsystem.component.WappTitle | ||
import com.wap.wapp.core.commmon.util.DateUtil | ||
import com.wap.wapp.core.model.survey.SurveyForm | ||
import com.wap.wapp.feature.survey.R | ||
|
||
@Composable | ||
internal fun SurveyOverview( | ||
surveyForm: SurveyForm, | ||
modifier: Modifier, | ||
eventName: String, | ||
onStartSurveyButtonClicked: () -> Unit, | ||
) { | ||
Column(modifier = modifier) { | ||
WappTitle( | ||
title = surveyForm.title, | ||
content = surveyForm.content, | ||
) | ||
|
||
Column( | ||
modifier = Modifier | ||
.padding(top = 40.dp) | ||
.weight(1f), | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
) { | ||
SurveyOverviewText(category = stringResource(R.string.event), content = eventName) | ||
|
||
SurveyOverviewText( | ||
category = stringResource(R.string.deadline), | ||
content = surveyForm.deadline.format(DateUtil.yyyyMMddFormatter), | ||
) | ||
|
||
SurveyOverviewText( | ||
category = stringResource(R.string.questionTotalNumber), | ||
content = surveyForm.surveyQuestionList.size.toString(), | ||
) | ||
} | ||
|
||
WappButton( | ||
textRes = R.string.start_survey, | ||
onClick = onStartSurveyButtonClicked, | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
private fun SurveyOverviewText(category: String, content: String) { | ||
Text( | ||
text = buildAnnotatedString { | ||
withStyle( | ||
SpanStyle(color = WappTheme.colors.white), | ||
) { | ||
append("$category : ") | ||
} | ||
withStyle( | ||
SpanStyle(color = WappTheme.colors.yellow34), | ||
) { | ||
append(content) | ||
} | ||
}, | ||
style = WappTheme.typography.titleBold, | ||
) | ||
} |