Skip to content

Commit

Permalink
ADD - danger link button #ANDROID-14534 (#343)
Browse files Browse the repository at this point in the history
* ADD - danger link button, both small and inverse variants. Also small link and inverse small link variants added #ANDROID-14534

* ADD - new styles and layouts to ButtonTest #ANDROID-14534

* Updated screenshots baseline

* Trigger github actions

* Move layouts from library module to library-test-utils #ANDROID-14534

* Remove chevron from danger link #ANDROID-14534

* Fix background color #ANDROID-14534

---------

Co-authored-by: juangardi21 <[email protected]>
  • Loading branch information
juangardi21 and juangardi21 authored Apr 25, 2024
1 parent 6aecf64 commit d73c863
Show file tree
Hide file tree
Showing 304 changed files with 290 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ class ButtonsCatalogFragment : Fragment() {

listOf(
R.id.link_progress,
R.id.link_inverse_progress
R.id.link_inverse_progress,
R.id.danger_link_progress,
R.id.danger_link_inverse_progress,
R.id.danger_link_small_progress,
R.id.danger_link_small_inverse_progress
)
.map { view.findViewById<Button>(it) }
.forEach { button ->
Expand All @@ -61,4 +65,4 @@ class ButtonsCatalogFragment : Fragment() {
private companion object {
const val LOADING_TIME = 2000L
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private fun Buttons(
)

val scope = rememberCoroutineScope()
ButtonStyle.values()
ButtonStyle.entries
.filter(filter)
.forEach {
CatalogButton(
Expand Down Expand Up @@ -144,4 +144,4 @@ private fun CatalogButton(
withChevron = withChevron,
onClickListener = onClickListener,
)
}
}
132 changes: 131 additions & 1 deletion catalog/src/main/res/layout/screen_buttons_catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,71 @@
app:style="LINK"
app:withChevron="true" />


<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link"
app:style="DANGER_LINK" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Icon"
app:icon="@drawable/icn_creditcard"
app:iconTint="@color/text_button_link_inverse_selector"
app:style="DANGER_LINK" />

<com.telefonica.mistica.button2.Button
android:id="@+id/danger_link_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Progress"
app:style="DANGER_LINK" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:enabled="false"
android:text="Danger Link Disabled"
app:style="DANGER_LINK" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link"
app:style="DANGER_LINK_SMALL" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Icon"
app:icon="@drawable/icn_creditcard"
app:iconTint="@color/text_button_link_inverse_selector"
app:style="DANGER_LINK" />

<com.telefonica.mistica.button2.Button
android:id="@+id/danger_link_small_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Progress"
app:style="DANGER_LINK_SMALL" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:enabled="false"
android:text="Danger Link Disabled"
app:style="DANGER_LINK_SMALL" />

</LinearLayout>

<com.telefonica.mistica.title.TitleView
Expand Down Expand Up @@ -456,8 +521,73 @@
app:style="LINK_INVERSE"
app:withChevron="true" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link"
app:style="DANGER_LINK_INVERSE" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Icon"
app:icon="@drawable/icn_creditcard"
app:iconTint="@color/text_button_link_inverse_selector"
app:style="DANGER_LINK_INVERSE" />

<com.telefonica.mistica.button2.Button
android:id="@+id/danger_link_inverse_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Progress"
app:style="DANGER_LINK_INVERSE" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:enabled="false"
android:text="Danger Link Disabled"
app:style="DANGER_LINK_INVERSE" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link"
app:style="DANGER_LINK_SMALL_INVERSE" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Icon"
app:icon="@drawable/icn_creditcard"
app:iconTint="@color/text_button_link_inverse_selector"
app:style="DANGER_LINK_SMALL_INVERSE" />

<com.telefonica.mistica.button2.Button
android:id="@+id/danger_link_small_inverse_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Danger Link Progress"
app:style="DANGER_LINK_SMALL_INVERSE" />

<com.telefonica.mistica.button2.Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:enabled="false"
android:text="Danger Link Disabled"
app:style="DANGER_LINK_SMALL_INVERSE"
tools:ignore="TooManyViews"/>

</LinearLayout>

</LinearLayout>

</ScrollView>
</ScrollView>
6 changes: 6 additions & 0 deletions library-test-utils/src/main/res/layout/danger_link_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.telefonica.mistica.button.Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/AppTheme.Button.DangerLinkButton"
/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.telefonica.mistica.button.Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/AppTheme.Button.DangerLinkButtonInverse"
/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.telefonica.mistica.button.Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/AppTheme.Button.DangerLinkButton.Small"
/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.telefonica.mistica.button.Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/AppTheme.Button.DangerLinkButtonInverse.Small"
/>
6 changes: 6 additions & 0 deletions library-test-utils/src/main/res/layout/link_small_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.telefonica.mistica.button.Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/AppTheme.Button.LinkButton.Small"
/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.telefonica.mistica.button.Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/AppTheme.Button.LinkButtonInverse.Small"
/>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added library/screenshots/Button_LINK_SMALL_O2Brand.png
Binary file added library/screenshots/Button_LINK_SMALL_TuBrand.png
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,11 @@ private fun Int?.toButtonStyle(): ButtonStyle = when (this) {
9 -> ButtonStyle.SECONDARY_INVERSE
10 -> ButtonStyle.SECONDARY_SMALL_INVERSE
11 -> ButtonStyle.LINK_INVERSE
12 -> ButtonStyle.LINK_SMALL
13 -> ButtonStyle.LINK_SMALL_INVERSE
14 -> ButtonStyle.DANGER_LINK
15 -> ButtonStyle.DANGER_LINK_INVERSE
16 -> ButtonStyle.DANGER_LINK_SMALL
17 -> ButtonStyle.DANGER_LINK_SMALL_INVERSE
else -> ButtonStyle.PRIMARY
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ enum class ButtonStyle {
PRIMARY_SMALL_INVERSE,
SECONDARY_INVERSE,
SECONDARY_SMALL_INVERSE,
LINK_INVERSE
LINK_INVERSE,
LINK_SMALL,
LINK_SMALL_INVERSE,
DANGER_LINK,
DANGER_LINK_INVERSE,
DANGER_LINK_SMALL,
DANGER_LINK_SMALL_INVERSE,
}

@Preview
Expand Down Expand Up @@ -271,6 +277,18 @@ fun LinkWithChevronPreview() {
}
}

@Preview
@Composable
fun DangerLinkWithChevronPreview() {
MisticaTheme(brand = MovistarBrand) {
Button(
text = "Text",
buttonStyle = ButtonStyle.DANGER_LINK,
onClickListener = {},
)
}
}

class PreviewBooleanProvider : PreviewParameterProvider<Boolean> {
override val values = sequenceOf(false, true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ internal fun ButtonStyle.getButtonSizeCompose(): ButtonSizeConfig =
ButtonStyle.SECONDARY_SMALL,
ButtonStyle.LINK,
ButtonStyle.LINK_INVERSE,
ButtonStyle.LINK_SMALL,
ButtonStyle.LINK_SMALL_INVERSE,
ButtonStyle.DANGER_LINK_SMALL,
ButtonStyle.DANGER_LINK_SMALL_INVERSE,
-> getSmallButtonSizeConfig()
else -> getDefaultButtonSizeConfig()
}
Expand All @@ -50,4 +54,4 @@ private fun getSmallButtonSizeConfig() = ButtonSizeConfig(
progressBarSize = 16.dp,
progressBarStroke = 1.dp,
horizontalPadding = 12.dp
)
)
Loading

0 comments on commit d73c863

Please sign in to comment.