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

Implemented BccProgress component #242

Merged
merged 10 commits into from
Sep 19, 2023

Conversation

steffanhalv
Copy link
Contributor

@steffanhalv steffanhalv commented Sep 16, 2023

Change summary

Change type

  • No review
  • Small PR
  • Big PR
  • Refactor

Fixes #22
Fixes #238

@laurensgroeneveld
Copy link
Collaborator

I see there's quite a bit of linting errors and realized there was not yet anything about it in the readme. I've added a section on linting now: #246

@steffanhalv
Copy link
Contributor Author

steffanhalv commented Sep 18, 2023

I see there's quite a bit of linting errors and realized there was not yet anything about it in the readme. I've added a section on linting now: #246

Fixed @laurensgroeneveld

Copy link
Collaborator

@laurensgroeneveld laurensgroeneveld left a comment

Choose a reason for hiding this comment

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

Really nice component with great customization 👌 Just got a few small comments, let me know if you don't agree with something!

* A `progress` element supporting current and max values
*/
export default {
title: "Forms/BccProgress",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the Forms section should be reserved for elements that you'd use in an HTML form, like inputs and buttons. I'll admit this one is a bit on the edge but I suggest placing it in Components for now (we can create more subcategories as the component list grows).

Comment on lines 51 to 52
:class="$attrs['class']"
:style="$attrs['style'] as StyleValue"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Vue will add any class and style elements by default on the outer element, so if that's the intention then this is not needed. In some cases, like the Input component, it seemed to make more sense to add classes to the input element itself, not the wrapping div. But in this case I think it's fine to put the classes on here, and then this code is not needed.

Comment on lines 1 to 5
<script lang="ts">
export default {
inheritAttrs: false,
};
</script>
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above comment.

Comment on lines 41 to 43
"h-1": props.size === "sm",
"h-1.5": props.size === "base",
"h-2": props.size === "lg",
Copy link
Collaborator

Choose a reason for hiding this comment

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

These can be custom classes as well, bcc-progress-sm etc. (just to make it easier for people using the library as a CSS library).

@laurensgroeneveld
Copy link
Collaborator

Hmm I see the Storybook deploy is failing because there is no deploy token. Unfortunately there doesn't seem to be a way other than changing the workflow trigger to change this, but that has a lot of downsides so I don't think that's a good idea.

Since you're a member of bcc-code, it should work if the branch is created on the repository (instead of a fork). I've tested it locally though so for this PR it's fine, I'll bypass the failing build when merging 👍

@steffanhalv
Copy link
Contributor Author

steffanhalv commented Sep 19, 2023

I did some other updates now to allow full customization, moved it to components and removed the $attrs inheritation with a story for how to fully customize the component.

@laurensgroeneveld

Comment on lines 46 to 60
const barClass = computed(() => {
if (props.barClass) return props.barClass;
if (
typeof progressClass.value === "object" &&
Object.keys(progressClass.value).includes("bcc-progress")
) {
const clone: any = { ...progressClass.value };
delete clone["bcc-progress"];
return {
...clone,
"bcc-progress-bar": true,
};
}
return progressClass.value;
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a bit ambivalent towards this. On the one hand it's a nice way of handing control to the consumer of the library. On the other hand, an explicit goal of this library is to have a limited set of options, so developers are forced to work within the constraints of the design system (perhaps this goal should be better articulated somewhere). I personally feel this makes the code a bit less readable as well.

I'd be inclined to suggest to not add these class props. Instead, people can override the classes that are already there (like bcc-progress) in the normal CSS way. The Event app (my.event.bcc.no) does this to add dark mode support for example.

What do you think, do you agree with the above reasoning? Maybe we should have a broader discussion about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, simplified it now 👍🏼

@steffanhalv
Copy link
Contributor Author

Check update @laurensgroeneveld

Copy link
Collaborator

@laurensgroeneveld laurensgroeneveld left a comment

Choose a reason for hiding this comment

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

Nice work 🙌

@laurensgroeneveld laurensgroeneveld merged commit a04bda9 into bcc-code:main Sep 19, 2023
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spinners & Progress Bars Progress bar
2 participants