Skip to content

Latest commit

ย 

History

History
99 lines (84 loc) ยท 3.82 KB

compose.md

File metadata and controls

99 lines (84 loc) ยท 3.82 KB

Compose

Component

Item Rule
Location 1 feature โ†’ feature/<x>/impl/.../component/<screen>/, internal. 2+ features โ†’ core/designsystem/.../component/, Routee prefix (modularization)
Name Figma name in PascalCase. Add the shape when it helps (Card, Chip, Bar). Use the Android term when Figma differs (modal โ†’ Dialog), Figma name in the // comment
Fixed content Take values, not a slot, when Figma never changes the items
List parameter List. ImmutableList only for lists in UiState (ui-state)
Screen Route, Screen, events (screen)
// feature_card_android            โ† Figma ์ด๋ฆ„. designsystem์€ ์ฃผ์„, feature๋Š” KDoc ๊ด„ํ˜ธ
private val ItemSpacing = 4.dp     // ํ† ํฐ์— ์—†๋Š” ๊ฐ’๋งŒ private ์ƒ์ˆ˜

/**
 * ๊ธฐ๋Šฅ ์นด๋“œ
 *
 * @param title    ์ œ๋ชฉ
 * @param value    ํ™”๋ฉด์— ๋ณด์ผ ๋ฌธ์ž์—ด (์˜ˆ: "15.53")
 * @param onClick  ํƒญ ์‹œ ํ˜ธ์ถœ
 * @param badge    ์˜ค๋ฅธ์ชฝ ๋ฑƒ์ง€. null ์ด๋ฉด ์ˆจ๊น€
 */
@Composable
fun RouteeFeatureCard(
    title: String,                 // ํ•„์ˆ˜ โ†’ modifier โ†’ ์„ ํƒ โ†’ content ์ˆœ์„œ
    value: String,
    onClick: () -> Unit,
    modifier: Modifier = Modifier, // modifier๋Š” @param ์ƒ๋žต
    badge: String? = null,
)
KDoc Rule
Title Short noun phrase. Feature module: ์„ค๋ช… (figma_name)
Behavior Aligned @param lines with short phrases (ํƒญ ์‹œ ํ˜ธ์ถœ, null ์ด๋ฉด ์ˆจ๊น€, true ์ด๋ฉด ~ ํ‘œ์‹œ)
Skip modifier, width/size notes (ํญ์€ [modifier]๋กœ ์ •ํ•œ๋‹ค)

Design Tokens

Value Use
Color RouteeTheme.colors
Text style RouteeTheme.typography
Spacing RouteeTheme.spacing
Corner radius RouteeTheme.radius (Full for pills)
Icon size, Figma-only gap private val Xxx = 28.dp in the file
Drawable size mismatch Modifier.size(). Don't edit the drawable

Text

Text Use Example
Must keep meaning, one line in a fixed cell RouteeAutoSizeText Numbers in a card, short labels
Must keep meaning, free height Text (wrap) Guide text, dialog body
Can be cut Text + maxLines = 1 + TextOverflow.Ellipsis Chip, button, address, tab
RouteeAutoSizeText(text = value, style = RouteeTheme.typography.displaySb28) // ๋„˜์น˜๋ฉด 12sp๊นŒ์ง€ ์ค„์ž„. ์ปค์ง€์ง€๋Š” ์•Š์Œ
// 200% ๊ธ€์ž์—์„œ ๊ฒน์น˜๊ฑฐ๋‚˜ ์‚ฌ๋ผ์ง€๋Š” ๊ฒŒ ์—†์œผ๋ฉด ํ†ต๊ณผ

Preview

Target Annotation
Component @PreviewFontSizes (default + 200% font)
Screen @PreviewDeviceSizes (phone, 200% font, short phone, foldable. No system bars)
// ์ปดํฌ๋„ŒํŠธ: @Preview ๋Œ€์‹ . ํฐํŠธ ํฌ๊ธฐ ํ™•์ธ์šฉ
@PreviewFontSizes
@Composable
private fun FeatureButtonPreview() {
    RouteePreviewTheme {
        Column { // ์ƒํƒœ๊ฐ€ ์—ฌ๋Ÿฌ ๊ฐœ๋ฉด ํ•œ Preview์— ๋‚˜์—ด
            FeatureButton(isSelected = false, onClick = {})
            FeatureButton(isSelected = true, onClick = {})
        }
    }
}

// ํ™”๋ฉด: Route๊ฐ€ ์•„๋‹Œ Screen์„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ. ํ•„์š”์‹œ ์‚ฌ์šฉ
@PreviewDeviceSizes
@Composable
private fun FeatureScreenPreview() {
    RouteePreviewTheme {
        FeatureScreen(uiState = FeatureUiState())
    }
}
Item Rule
Function private, <Component>Preview, <Screen>Preview
Annotations core/designsystem/.../preview/
Theme RouteeTheme, or RouteePreviewTheme when the app background helps