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

refactor: preview 수정 및 state Hoisting 적용 #197

Open
wants to merge 42 commits into
base: refactor-state-hoisting
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2dd43ad
refactor: NotificationScreenPreview 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
841361a
refactor: CreateQuestionScreenPreview 오류 해결, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
e3fea50
refactor: CreateStudyScreenPreview 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
6a5d795
refactor: QuestionDetailScreenPreview 오류 수정, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
87e723a
refactor: OwnerQuizResultScreenPreview 오류 수정, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
ad80fe5
refactor: GeneralQuizResultScreenPreview 오류 수정, 언어 한글로 변경 (#196)
pengcon Jan 9, 2025
265147d
feat: GeneralQuiz,OwnerQuiz의 Preview에 공통 활용되는 Questions 데이터 구성(#196)
pengcon Jan 9, 2025
2936826
refactor: ktlint 적용 (#196)
pengcon Jan 9, 2025
0c51c35
refactor: QuizOwnerDialogPreview 네이밍 수정, dark / light prievew 추가, 언어 …
pengcon Jan 14, 2025
062d882
refactor: QuizSolveTimeSliderPreview dark / light prievew 추가, 언어 ko로 …
pengcon Jan 14, 2025
5ab399c
feat: QuizTopAppBarPreview 추가 (#196)
pengcon Jan 14, 2025
69072de
feat: RadioTextButtonPreview 추가 (#196)
pengcon Jan 14, 2025
3c61d09
feat: RealTimeQuestionPreview 추가 (#196)
pengcon Jan 14, 2025
2904e28
feat: RealTimeQuizGuideContentPreview 추가 (#196)
pengcon Jan 14, 2025
f5692d0
refactor: quiz component internal keyword 적용(#196)
pengcon Jan 14, 2025
440830c
refactor: 미사용 컴포넌트 UserQuestion 삭제 (#196)
pengcon Jan 15, 2025
46f0778
refactor: CreateQuestionScreenPreview 다크모드 적용,showBackground 제거 (#196)
pengcon Jan 15, 2025
e3fb208
refactor: CreateStudyScreenPreview 다크모드 적용,showBackground 제거 (#196)
pengcon Jan 15, 2025
8ea1a00
refactor: GeneralQuizResultScreenPreview 다크모드 적용,showBackground 제거 (#…
pengcon Jan 15, 2025
6f87526
refactor: NotificationScreenPreview 다크모드 적용 (#196)
pengcon Jan 15, 2025
1414bfc
refactor: OwnerQuizResultScreenPreview 다크모드 적용,showBackground 제거 (#196)
pengcon Jan 15, 2025
a9bf2c7
refactor: QuestionDetailScreenPreview 다크모드 적용 (#196)
pengcon Jan 15, 2025
db1b518
refactor: quiz 컴포넌트 다크모드 적용 (RadioTextButton 제외) (#196)
pengcon Jan 15, 2025
7615e0c
refactor: OwnerQuizResultScreen import 정리 (#196)
pengcon Jan 15, 2025
f80ab93
Merge remote-tracking branch 'origin/refactor-state-hoisting' into re…
pengcon Jan 15, 2025
65aac5d
refactor: QuizOwnerDialogPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
2f12d48
refactor: CreateQuestionScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
4570e47
refactor: CreateStudyScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
3f73f6d
refactor: GeneralQuizResultScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
d4a8ef6
refactor: NotificationScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
1a8ab39
refactor: OwnerQuizResultScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
4e9abb1
refactor: QuestionDetailScreenPreview에 PreviewKoLightDark 적용 (#196)
pengcon Jan 15, 2025
bac024e
refactor: QuizOwnerDialog import 정리 (#196)
pengcon Jan 15, 2025
2bcc528
refactor: preview에 private 키워드 추가 (#196)
pengcon Jan 15, 2025
812f957
refactor: QuestionDetailScreenPreviewParameterProvider에 internal 키워드 …
pengcon Jan 15, 2025
2ed58e1
refactor: Screen 내부에 접근 제한자 추가 (#196)
pengcon Jan 18, 2025
eea0fa4
refactor: QuestionDetailScreenPreview 에 사용되는 PreviewProvider를 Questio…
pengcon Jan 18, 2025
3f22a0e
feat: PreviewKoLightDarkBackground 어노테이션 추가 (#196)
pengcon Jan 18, 2025
3a7ffe2
refactor: 컴포넌트에 PreviewKoLightDarkBackground 어노테이션 적용 (#196)
pengcon Jan 18, 2025
a2bd89f
refactor: quizResultPreviewQuestions 변수 QuizResultParameterProvider로 …
pengcon Jan 18, 2025
0106bcd
refactor: QuizResultScreen에 quizResultPreviewQuestions 변수 삭제 (#196)
pengcon Jan 18, 2025
5b896a7
refactor: GeneralQuizResultScreen,QuizResultScreen import 정리 (#196)
pengcon Jan 18, 2025
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

접근 제한자를 붙이지 않은 이유가 따로 있으실까요?

fun NotificationScreen(
    notificationInfos: List<NotificationWithGroupInfo>,
    onRejectClick: (String) -> Unit,
    onAcceptClick: (Notification) -> Unit,
    onNavigationButtonClick: () -> Unit,
    snackBarHostState: SnackbarHostState,
) 

fun QuestionResultItem(
    questionResult: QuestionResult,
    onQuestionClick: (String) -> Unit,
)

fun CreateStudyScreen(
    isEditMode: Boolean,
    defaultStudyImageUri: String?,
    currentStudyImage: ByteArray?,
    ... 생략
    onStudyEditButtonClick: () -> Unit,
    onCreationButtonClick: () -> Unit,
    onCurrentStudyImageChanged: (ByteArray) -> Unit,
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아니 스크린에 제한자를 다 빼먹었군요... 요번주에 혼이 나가있어서 실수가 많네요 수정하겠습니다!

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.domain.model.Notification
import kr.boostcamp_2024.course.domain.model.NotificationWithGroupInfo
Expand Down Expand Up @@ -98,7 +98,7 @@ fun NotificationScreen(
}
}

@Preview(locale = "ko")
@PreviewKoLightDark
@Composable
private fun NotificationScreenPreview() {
WeQuizTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package kr.boostcamp_2024.course.quiz.component
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizBaseDialog
import kr.boostcamp_2024.course.quiz.R
Expand Down Expand Up @@ -38,10 +37,9 @@ internal fun QuizOwnerDialog(
}
}

@Preview(locale = "ko")
@PreviewLightDark
@PreviewKoLightDark
@Composable
fun QuizOwnerDialogPreview() {
private fun QuizOwnerDialogPreview() {
WeQuizTheme {
QuizOwnerDialog(
isQuit = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.defaultMinSize
Expand All @@ -14,7 +16,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -50,9 +51,9 @@ internal fun QuizSolveTimeSlider(
}

@Preview(showBackground = true, locale = "ko")
@PreviewLightDark
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@Composable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 부분은 @PreviewKoLightDark가 적용되어 있지 않네요! 다른 부분도 @PreviewKoLightDark가 적용되어 있지 않은 부분이 꽤 있는 것 같아요! 확인 부탁드립니다!🙂

Copy link
Collaborator Author

@pengcon pengcon Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PreviewKoLightDark 가 적용 안된 컴포넌트들은 showBackground = true가 없으면 프리뷰가 이상하게 나와서 따로 설정해주었습니다😢
따로 어노테이션을 구성해야할지 (PreivewKoLightDarkWithBackground..???ㅋㅋㅋ) 아니면 이대로 둘지 토욜날 정해보죠..!
++ 영민님이 만드신 어노테이션이랑 맞춰서 구성하겠습니다!!

fun QuizSolveTimeSliderPreview() {
private fun QuizSolveTimeSliderPreview() {
QuizSolveTimeSlider(
value = 0f,
steps = 10,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.material.icons.Icons
Expand All @@ -24,7 +26,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizBaseDialog
import kr.boostcamp_2024.course.domain.model.BaseQuiz
import kr.boostcamp_2024.course.domain.model.Category
Expand Down Expand Up @@ -131,10 +132,10 @@ internal fun QuizTopAppBar(
}


@Preview(showBackground = true)
@PreviewLightDark
@Preview(showBackground = true, locale = "ko")
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@Composable
fun QuizTopAppBarPreview() {
private fun QuizTopAppBarPreview() {
QuizTopAppBar(
category = Category(id = "", name = "", description = "", categoryImageUrl = "", quizzes = emptyList()),
quiz = RealTimeQuiz(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp

@Composable
Expand Down Expand Up @@ -46,9 +45,8 @@ internal fun RadioTextButton(


@Preview(showBackground = true, locale = "ko")
@PreviewLightDark
@Composable
fun RadioTextButtonPreview() {
private fun RadioTextButtonPreview() {
RadioTextButton(
text = "문제",
selected = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -12,7 +14,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp

@Composable
Expand Down Expand Up @@ -53,7 +54,7 @@ internal fun RealTimeQuestion(
}

@Preview(showBackground = true, locale = "ko")
@PreviewLightDark
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@Composable
private fun RealTimeQuestionPreview() {
RealTimeQuestion(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package kr.boostcamp_2024.course.quiz.component

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.content.res.Configuration.UI_MODE_TYPE_NORMAL
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -12,7 +14,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizLocalRoundedImage
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizRightChatBubble
Expand Down Expand Up @@ -56,7 +57,7 @@ internal fun RealTimeQuizGuideContent(
}

@Preview(showBackground = true, locale = "ko")
@PreviewLightDark
@Preview(uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL, locale = "ko")
@Composable
private fun RealTimeQuizGuideContentPreview() {
RealTimeQuizGuideContent(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.quiz.R
import kr.boostcamp_2024.course.quiz.component.CreateBlankQuestionContent
Expand Down Expand Up @@ -307,9 +307,9 @@ fun CreateQuestionScreen(
}
}

@Preview(showBackground = true, locale = "ko")
@PreviewKoLightDark
@Composable
fun CreateQuestionScreenPreview() {
private fun CreateQuestionScreenPreview() {
val previewCreateQuestionUiState = CreateQuestionUiState(
isLoading = false,
showDialog = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.domain.model.BlankQuestion
import kr.boostcamp_2024.course.domain.model.ChoiceQuestion
Expand Down Expand Up @@ -138,7 +138,7 @@ fun QuestionDetailScreen(
}
}

class QuestionDetailScreenPreviewParameterProvider : PreviewParameterProvider<Question> {
internal class QuestionDetailScreenPreviewParameterProvider : PreviewParameterProvider<Question> {
override val values = sequenceOf(
BlankQuestion(
id = "1",
Expand All @@ -162,9 +162,9 @@ class QuestionDetailScreenPreviewParameterProvider : PreviewParameterProvider<Qu
)
}

@Preview(locale = "ko")
@PreviewKoLightDark
@Composable
fun QuestionDetailScreenPreview(
private fun QuestionDetailScreenPreview(
@PreviewParameter(QuestionDetailScreenPreviewParameterProvider::class) question: Question,
pengcon marked this conversation as resolved.
Show resolved Hide resolved
) {
WeQuizTheme {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kr.boostcamp_2024.course.quiz.presentation.quiz

import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -36,8 +35,8 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizLocalRoundedImage
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizRightChatBubble
Expand Down Expand Up @@ -209,17 +208,9 @@ fun GeneralQuestionResultItem(
}
}

@Preview(
showBackground = true,
locale = "ko",
uiMode = Configuration.UI_MODE_NIGHT_YES,
)
@Preview(
showBackground = true,
locale = "ko",
)
@PreviewKoLightDark
@Composable
fun GeneralQuizResultScreenPreview() {
private fun GeneralQuizResultScreenPreview() {
val generalQuizResultPreviewUserOmrAnswers = listOf(0, 1, "")
WeQuizTheme {
GeneralQuizResultScreen(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kr.boostcamp_2024.course.quiz.presentation.quiz

import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -35,8 +34,8 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizLocalRoundedImage
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizRightChatBubble
Expand Down Expand Up @@ -186,14 +185,10 @@ fun OwnerQuestionResultItem(
}
}

@Preview(
showBackground = true,
locale = "ko",
uiMode = Configuration.UI_MODE_NIGHT_YES,
)
@Preview(showBackground = true, locale = "ko")

@PreviewKoLightDark
@Composable
fun OwnerQuizResultScreenPreview() {
private fun OwnerQuizResultScreenPreview() {
WeQuizTheme {
OwnerQuizResultScreen(
onNavigationButtonClick = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kr.boostcamp_2024.course.designsystem.ui.annotation.PreviewKoLightDark
import kr.boostcamp_2024.course.designsystem.ui.theme.WeQuizTheme
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizCircularProgressIndicator
import kr.boostcamp_2024.course.designsystem.ui.theme.component.WeQuizValidateTextField
Expand Down Expand Up @@ -175,9 +175,9 @@ fun isValidateNumber(inputNumber: String): Boolean {
return isValid && inputNumber.toIntOrNull()?.let { it in 2..50 } == true
}

@Preview(showBackground = true, locale = "ko")
@PreviewKoLightDark
@Composable
fun CreateStudyScreenPreview() {
private fun CreateStudyScreenPreview() {
WeQuizTheme {
CreateStudyScreen(
isEditMode = false,
Expand Down