Skip to content

Commit

Permalink
Tab 컴포넌트 추가 (#8)
Browse files Browse the repository at this point in the history
* feat : add Tab file

* feat : FixedTab 구현

* feat : indicator 색상 지정

* feat : ScrollableTab 구현

* feat : 주석 수정

* feat : indicator 너비 수정

* feat : 주석 수정

* feat : 변수 수정

* feat : 코드 수정

* feat : text 글자수 조건 추가

* feat : 프리뷰 수정

* feat : 프리뷰 수정

* feat : 예외처리 삭제

* feat : 주석 수정

* feat : tab 조건 수정

* feat : tab 조건 수정

* feat : tab 조건 수정

* feat : indicator radius

* feat : scrollableTab 중앙 정렬

* feat : 주석 추가

* feat : text 수정

* chore : contentColor 삭제

* chore : add Modifier in Tab

* chore : FixedTab, ScrollableTab 기본값 및 프리뷰 추가

* chore : delete object

* chore : add indicator animation

* chore : delete Tab

* chore : import TabBarDefaults
  • Loading branch information
leeeyubin authored Aug 20, 2024
1 parent 3c35de9 commit a3ac906
Show file tree
Hide file tree
Showing 2 changed files with 521 additions and 0 deletions.
61 changes: 61 additions & 0 deletions app/src/main/kotlin/com/yourssu/handy/demo/TabPreview.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.yourssu.handy.demo

import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.tooling.preview.Preview
import com.yourssu.handy.compose.FixedTab
import com.yourssu.handy.compose.HandyTheme
import com.yourssu.handy.compose.ScrollableTab
import com.yourssu.handy.compose.TabItem

@Preview(showBackground = true)
@Composable
private fun FixedTabPreview() {
var tabIndex by remember { mutableIntStateOf(0) }
val fixedTabs = listOf("Tab1", "Tab2")
HandyTheme {
Column {
FixedTab(
selectedTabIndex = tabIndex,
) {
fixedTabs.forEachIndexed { index, title ->
TabItem(
text = title,
selected = index == tabIndex,
onClick = {
tabIndex = index
},
)
}
}
}
}
}

@Preview(showBackground = true)
@Composable
private fun ScrollableTabPreview() {
var tabIndex by remember { mutableIntStateOf(0) }
val scrollableTabs = listOf("안드로이드", "Tab2", "Tab3", "Tab4", "Tab5", "Tab6")
HandyTheme {
Column {
ScrollableTab(
selectedTabIndex = tabIndex
) {
scrollableTabs.forEachIndexed { index, title ->
TabItem(
text = title,
selected = index == tabIndex,
onClick = {
tabIndex = index
}
)
}
}
}
}
}
Loading

0 comments on commit a3ac906

Please sign in to comment.