Skip to content

Commit

Permalink
Merge pull request #236 from tarkalabs/younes/TUIButtonEnabled
Browse files Browse the repository at this point in the history
Fixing Tests, Adding Boolean to Show and Hide the TUIAttachment Upload
  • Loading branch information
deekshitheam360 authored May 10, 2024
2 parents d4a6bc7 + 7d6044a commit 7a34948
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 30 deletions.
19 changes: 15 additions & 4 deletions example/src/main/java/com/tarkalabs/ui/UIComponentListActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.tarkalabs.tarkaui.components.TUIAppTopBar
import com.tarkalabs.tarkaui.components.TUIAttachmentUpload
import com.tarkalabs.tarkaui.components.TUIAttachmentUpload.AttachmentState.UpLoading
import com.tarkalabs.tarkaui.components.TUIMediaThumbnailType.Document
import com.tarkalabs.tarkaui.components.TUITextRow
import com.tarkalabs.tarkaui.components.TextRowStyle
import com.tarkalabs.tarkaui.components.VerticalSpacer
import com.tarkalabs.tarkaui.icons.ChevronRight20
import com.tarkalabs.tarkaui.icons.Delete24
import com.tarkalabs.tarkaui.icons.TarkaIcons
import com.tarkalabs.tarkaui.icons.TarkaIcons.Regular
import com.tarkalabs.tarkaui.theme.TUITheme

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
Expand Down Expand Up @@ -56,10 +61,16 @@ class UIComponentListActivity : ComponentActivity() {
.fillMaxHeight()
.padding(horizontal = 8.dp)
) {
VerticalSpacer(space = 20)
TUITextRow(title = "Dates", style = TextRowStyle.DateStyle("26-11-2020","26-11-2200"))
VerticalSpacer(space = 20)
TUITextRow(title = "Dates", style = TextRowStyle.DateStyle("Not Available","Not Available"))
TUIAttachmentUpload(
type = Document,
attachmentName = "document.jpg",
onTrailingIconClick = {},
onAttachmentClick = { },
state = UpLoading(50),
showLeadingIcon = true,
trailingIcon = Regular.Delete24,
showDeleteButton = true
)
}

}
Expand Down
2 changes: 1 addition & 1 deletion tarka-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ publishing {
run {
groupId = "com.tarkalabs"
artifactId = getLibraryArtifactId()
version = "1.1.19"
version = "1.1.20"
artifact("$buildDir/outputs/aar/tarka-ui-release.aar")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.tarkalabs.tarkaui.icons.TarkaIcons.Regular
import com.tarkalabs.tarkaui.components.email.TUIEmailField
import com.tarkalabs.tarkaui.components.email.TUIEmailFieldTags
import com.tarkalabs.tarkaui.components.base.TUIIconButtonTags
import kotlinx.collections.immutable.toImmutableList
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.mock
Expand All @@ -40,7 +41,7 @@ class TUIEmailFieldTest {
}
TUIEmailField(
title = "To",
emailAddressList = emailList,
emailAddressList = emailList.toImmutableList(),
trailingIcon = Regular.AddCircle24,
onItemRemoved = {},
trailingIconClick = {
Expand Down Expand Up @@ -79,7 +80,7 @@ class TUIEmailFieldTest {
}
TUIEmailField(
title = "To",
emailAddressList = emailList,
emailAddressList = emailList.toImmutableList(),
trailingIcon = Regular.AddCircle24,
onItemRemoved = {},
trailingIconClick = trailingIconClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.tarkalabs.tarkaui.components.tab.TUITabBarTags
import com.tarkalabs.tarkaui.components.tab.TabItem
import com.tarkalabs.tarkaui.icons.Tabs24
import com.tarkalabs.tarkaui.icons.TarkaIcons
import kotlinx.collections.immutable.toImmutableList
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.mock
Expand All @@ -36,7 +37,7 @@ class TUITabBarTest {

composeTestRule.setContent {
TUITabBar(
tabItems = tabItems,
tabItems = tabItems.toImmutableList(),
selectedTabIndex = 1,
tags = testTags,
onTabChanged = {},
Expand All @@ -61,7 +62,7 @@ class TUITabBarTest {

composeTestRule.setContent {
TUITabBar(
tabItems = tabItems,
tabItems = tabItems.toImmutableList(),
selectedTabIndex = 1,
tags = testTags,
onTabChanged = {},
Expand All @@ -82,7 +83,7 @@ class TUITabBarTest {

composeTestRule.setContent {
TUITabBar(
tabItems = tabItems,
tabItems = tabItems.toImmutableList(),
selectedTabIndex = 0,
tags = testTags,
onTabChanged = {},
Expand All @@ -105,7 +106,7 @@ class TUITabBarTest {

composeTestRule.setContent {
TUITabBar(
tabItems = tabItems,
tabItems = tabItems.toImmutableList(),
selectedTabIndex = 2,
tags = testTags,
onTabChanged = {},
Expand All @@ -132,7 +133,7 @@ class TUITabBarTest {

composeTestRule.setContent {
TUITabBar(
tabItems = tabItems,
tabItems = tabItems.toImmutableList(),
selectedTabIndex = 0,
tags = testTags,
onTabChanged = onTabChange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.tarkalabs.tarkaui.components.tab.TUITabBar
import com.tarkalabs.tarkaui.components.tab.TabItem
import com.tarkalabs.tarkaui.icons.Circle12
import com.tarkalabs.tarkaui.icons.TarkaIcons.Regular
import kotlinx.collections.immutable.toImmutableList
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
Expand Down Expand Up @@ -78,7 +79,7 @@ class TUITabBarScreenshotTest(
compareScreenshotFor(darkTheme = darkTheme, imageName = "WithoutIcon_$testName") {
TUITabBar(
modifier = Modifier.padding(10.dp),
tabItems = tabItems,
tabItems = tabItems.toImmutableList(),
selectedTabIndex = 0,
onTabChanged = {}
)
Expand All @@ -88,7 +89,7 @@ class TUITabBarScreenshotTest(
compareScreenshotFor(darkTheme = darkTheme, imageName = "WithIcon_$testName") {
TUITabBar(
modifier = Modifier.padding(10.dp),
tabItems = tabItemsWithIcons,
tabItems = tabItemsWithIcons.toImmutableList(),
selectedTabIndex = 1,
onTabChanged = {}
)
Expand All @@ -98,7 +99,7 @@ class TUITabBarScreenshotTest(
compareScreenshotFor(darkTheme = darkTheme, imageName = "WithContent_$testName") {
TUITabBar(
modifier = Modifier.padding(10.dp),
tabItems = tabItemsWithContent,
tabItems = tabItemsWithContent.toImmutableList(),
selectedTabIndex = 2,
onTabChanged = {}
)
Expand All @@ -108,7 +109,7 @@ class TUITabBarScreenshotTest(
compareScreenshotFor(darkTheme = darkTheme, imageName = "WithIconAndContent_$testName") {
TUITabBar(
modifier = Modifier.padding(10.dp),
tabItems = tabItemsWithIconAndContent,
tabItems = tabItemsWithIconAndContent.toImmutableList(),
selectedTabIndex = 2,
onTabChanged = {}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ object TUIAttachmentUpload {
trailingIcon: TarkaIcon,
state: AttachmentState? = null,
showLeadingIcon: Boolean,
showDeleteButton : Boolean = true,
tags: TUIAttachmentUploadTags = TUIAttachmentUploadTags()
) {

Expand Down Expand Up @@ -155,15 +156,15 @@ object TUIAttachmentUpload {
AttachmentTitle(attachmentName = attachmentName, attachmentModifier)
}
}

TUIIconButton(
icon = trailingIcon,
iconButtonStyle = Ghost,
buttonSize = IconButtonSize.XL,
tags = tags.menuItemTag,
onIconClick = onTrailingIconClick
)

if (showDeleteButton) {
TUIIconButton(
icon = trailingIcon,
iconButtonStyle = Ghost,
buttonSize = IconButtonSize.XL,
tags = tags.menuItemTag,
onIconClick = onTrailingIconClick
)
}
}
}

Expand Down Expand Up @@ -233,15 +234,13 @@ object TUIAttachmentUpload {
TUIAttachmentUpload(
type = Document,
attachmentName = "document.jpg",
onTrailingIconClick = {

},
onTrailingIconClick = {},
onAttachmentClick = { },
state = UpLoading(50),
showLeadingIcon = true,
trailingIcon = TarkaIcons.Regular.Delete24
trailingIcon = TarkaIcons.Regular.Delete24,
showDeleteButton = false
)

}
}
}

0 comments on commit 7a34948

Please sign in to comment.