Decathlon / vitamin-ios

Decathlon Design System UI components for iOS & iPadOS applications
https://www.decathlon.design
Apache License 2.0
46 stars 14 forks source link

feat: snackbar UIKit implementation #107

Closed daniel-dumortier closed 1 year ago

daniel-dumortier commented 1 year ago

Changes description

Implementation of the Vitamin snackbar for UIKit

Context

The snackbar is a component that allows to display a short message on the screen, this PR aims to provide this component. fixes #21

It provides two way of displaying a Snackbar :

Checklist

Does this introduce a breaking change?

Screenshots

iPhone

Simulator Screen Shot - iPhone 8 - 2022-12-29 at 12 18 24 Simulator Screen Shot - iPhone 8 - 2022-12-29 at 12 18 35 Simulator Screen Shot - iPhone 8 - 2022-12-29 at 12 19 29 Simulator Screen Shot - iPhone 8 - 2022-12-29 at 12 19 20

iPad

Simulator Screen Shot - iPad (9th generation) - 2022-12-29 at 12 16 27 Simulator Screen Shot - iPad (9th generation) - 2022-12-29 at 12 17 04 Simulator Screen Shot - iPad (9th generation) - 2022-12-29 at 12 18 11 Simulator Screen Shot - iPad (9th generation) - 2022-12-29 at 12 17 50

Other information

This component has been asked by Domyos team for an upcoming feature

daniel-dumortier commented 1 year ago

Sorry, after re-reading the doc, I noticed my implementation lacked a feature : optional action should be triggerable when tapping the snackbar. I added that in this last commit. Can you just review this last point ? (I hope I did not made new typos, I carefully read my comments and docs, sorry in advance if i missed again some typos) Thanks !

daniel-dumortier commented 1 year ago

Sorry, but after further testing, noticed that the maxWidth did not work properly.

Furthermore, with the new signature on UIViewController's extension, the declaration of maxWidth was not clear, because it could be done on VitaminSnackbar or as method parameter, and both had not the same meaning, so purpose of each maxWidth was not really clear.

I changed :

After that, I needed to rearrange the code, to remain under the limit of 400 lines per file, to please Swiflint ;)

Hope this will be the last version, sorry for all this back and forth ;)

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication