Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Component Library to the app #8319

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Nov 7, 2024

Summary

Parallel to mattermost/mattermost#28826 , we add a component library to mobile.

Right now it follows the same logic as the web (developer mode is enabled in the server) but we could consider having this only for beta builds. 0/5 on this (not sure if builds from PRs are considered beta or not)

Ticket Link

NONE

Screenshots

Screencast.from.07-11-24.13.37.54.webm

Release Note

Adds "component library" debug menu for servers that have developer settings enabled.

@larkox larkox added the 2: Dev Review Requires review by a core commiter label Nov 7, 2024
@enahum
Copy link
Contributor

enahum commented Nov 7, 2024

Can you share context as to why do we need this?

@larkox
Copy link
Contributor Author

larkox commented Nov 7, 2024

The idea is to have an unified place where to play with certain components. Mainly for testing purposes.

In this example, the button component. Instead of trying to figure out where the button is used as "primary" or "tertiary" to see if the styles are correct, we can have a centralized place where to look at all of them at the same time. It would be something similar to have storybook, but inside the product, so we get the version of the button this build has.

@enahum
Copy link
Contributor

enahum commented Nov 7, 2024

The idea is to have an unified place where to play with certain components. Mainly for testing purposes.

In this example, the button component. Instead of trying to figure out where the button is used as "primary" or "tertiary" to see if the styles are correct, we can have a centralized place where to look at all of them at the same time. It would be something similar to have storybook, but inside the product, so we get the version of the button this build has.

Ok I follow.

Will the users be able to try this out or is it purely a dev thing?

@larkox
Copy link
Contributor Author

larkox commented Nov 7, 2024

Define users 😛

This is mainly intended for development and testing environments. End users should not be using this. That is the reason it is behind the "EnableDeveloper" setting, which should never be used in production.

That being said, end users seeing this screen is not a big deal. There is nothing bad they can do in this screen. We can try to make it prettier (since they may stumble unto it), but we should also make clear this is a development tool.

Comment on lines +15 to +18
const buttonSizeValues = ['xs', 's', 'm', 'lg'];
const buttonEmphasisValues = ['primary', 'secondary', 'tertiary', 'link'];
const buttonTypeValues = ['default', 'destructive', 'inverted', 'disabled'];
const buttonStateValues = ['default', 'hover', 'active', 'focus'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is a way for you to construct this array of values based on the styles of the buttons defined in @utils/buttonStyles so that if ever another one is added it won't be missing from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, it is a limitation from typescript. We can get types from runtime objects, but we cannot get runtime objects from types 😅
There are ways around that, but all of them look pretty ugly to me, and would imply extra changes in the code: https://stackoverflow.com/questions/75835161/typescript-convert-type-with-multiple-string-options-to-an-array-with-those-opti

Nevertheless, it is something we can consider for the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core commiter release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants