Skip to content

Commit

Permalink
Merge pull request #6 from Breens-Mbaka/develop
Browse files Browse the repository at this point in the history
Add ability to enable or disable table headers
  • Loading branch information
Breens-Mbaka authored Jul 30, 2023
2 parents 2fd386b + 60b7cc6 commit 0b45876
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
6 changes: 3 additions & 3 deletions BeeTablesCompose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "1.8"
}
buildFeatures {
compose = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.breens.beetablescompose.utils.extractMembers
* 🐝 A Compose UI data table library.
*
* @param data The list of data items to display in the table.
* @param enableTableHeaderTitles show or hide the table header titles. If not set, by default the table header titles will be shown.
* @param headerTableTitles The list of header titles to display at the top of the table.
* @param headerTitlesBorderColor The color of the border for the header titles, by default it will be [Color.LightGray].
* @param headerTitlesBorderWidth The width of the border for the header titles in DP, by default it will be "0.4.dp".
Expand All @@ -50,6 +51,7 @@ import com.breens.beetablescompose.utils.extractMembers
@Composable
inline fun <reified T : Any> BeeTablesCompose(
data: List<T>,
enableTableHeaderTitles: Boolean = true,
headerTableTitles: List<String>,
headerTitlesBorderColor: Color = Color.LightGray,
headerTitlesBorderWidth: Dp = 0.4.dp,
Expand All @@ -64,13 +66,15 @@ inline fun <reified T : Any> BeeTablesCompose(
) {
Card(elevation = CardDefaults.cardElevation(defaultElevation = tableElevation)) {
Column(modifier = Modifier.clip(shape = shape)) {
TableHeaderComponent(
headerTableTitles = headerTableTitles,
headerTitlesBorderColor = headerTitlesBorderColor,
headerTitlesBorderWidth = headerTitlesBorderWidth,
headerTitlesTextStyle = headerTitlesTextStyle,
headerTitlesBackGroundColor = headerTitlesBackGroundColor,
)
if (enableTableHeaderTitles) {
TableHeaderComponent(
headerTableTitles = headerTableTitles,
headerTitlesBorderColor = headerTitlesBorderColor,
headerTitlesBorderWidth = headerTitlesBorderWidth,
headerTitlesTextStyle = headerTitlesTextStyle,
headerTitlesBackGroundColor = headerTitlesBackGroundColor,
)
}

data.forEachIndexed { index, data ->
val rowData = extractMembers(data).map {
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@

To use the BeeTablesCompose library, follow these steps:

- Add this to either your **project build.gradle** file or **setting.gradle**, depending with what version of Android Studio you are using;

```gradle
repositories {
...
maven(url = "https://jitpack.io")
}
```

- Add the dependency: Include the library in your project's dependencies;

```gradle
dependencies {
implementation("com.github.Breens-Mbaka:BeeTablesCompose:1.0.2")
implementation("com.github.Breens-Mbaka:BeeTablesCompose:1.0.3")
}
```

Expand All @@ -57,7 +66,7 @@ dependencies {
titles as parameters to generate the data table.

<p align="center">
<img src="https://github.com/Breens-Mbaka/AnimeFollowKMM/assets/72180010/42f7fab4-cfe4-4236-968c-4a6eda006b0f" />
<img src="https://github.com/Breens-Mbaka/BeeTablesCompose/assets/72180010/f5ea94a1-df41-472c-91e2-03d6cb7dc82f" />

# Want a new shiny feature 🪩✨
- If you want to request a new feature please first read this [short guide](https://github.com/Breens-Mbaka/BeeTablesCompose/blob/master/.github/ISSUE_TEMPLATE/feature_request.md)
Expand Down
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jdk:
- openjdk17
- openjdk11
before_install:
- ./scripts/prepareJitpackEnvironment.sh

0 comments on commit 0b45876

Please sign in to comment.