Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.

Conversation

varun257
Copy link
Contributor

add oui skeleton component
add examples and test case

cui skeleton to oui

JIRA: UU-845


export default {
controller,
controllerAs: "$ctrl",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the default value, you can remove it

<span class="oui-skeleton__loader"
ng-show="$ctrl.loading"
data-ng-style="{width: $ctrl.width}"></span>
<div ng-hide="$ctrl.loading" ng-transclude></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

use ng-if

@@ -0,0 +1,28 @@
# Skeleton

<component-status cx-design="complete" ux="complete"></component-status>
Copy link
Contributor

@AxelPeter AxelPeter May 18, 2018

Choose a reason for hiding this comment

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

Update ux="complete" to rc. complete are only for components already integrated and tested in our apps.


| Attribute | Type | Binding | One-time Binding | Values | Default | Description
| ---- | ---- | ---- | ---- | ---- | ---- | ----
| width | string | @ | | | random (<100 or >30) | width of the element in percentage ("30%")
Copy link
Contributor

Choose a reason for hiding this comment

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

| Attribute | Type | Binding | One-time Binding | Values | Default | Description
| ---- | ---- | ---- | ---- | ---- | ---- | ----
| width | string | @ | | | random (<100 or >30) | width of the element in percentage ("30%")
| loading | boolean | < | | true, false | | boolean to indicate to show or hide the component
Copy link
Contributor

@AxelPeter AxelPeter May 18, 2018

Choose a reason for hiding this comment

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

Useless, could be done with an ngIf :)
See my comment about transclude first.

"ngInject";

this.$attrs = $attrs;
this.max = 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in CSS with max-width and min-width.
But like my upper comment said, we should go with sizes instead (s, m, l). By default, it could auto like we have for this component: https://master.ui-kit.ovh/#!/oui-angular/field

What do you think ? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup this should be good. Better than choosing random width. Will do this

loading: "<",
width: "@"
},
transclude: true
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this component should be used more like the spinner, not like a container that shows the content or not.
To be discussed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The transclude actually helps to show the skeleton before the actual component is loaded. When you have lots of fields in a page, transclude makes it easier to wrap the skeleton on every component and show the actual component when loaded.
Other than this, there is no other real use of it. But this also means showing whichever loads first or like showing multiple spinners. Which might not look so good.

@varun257 varun257 changed the base branch from master to develop May 21, 2018 05:43
@varun257
Copy link
Contributor Author

@AxelPeter have a look at it now. I think this should do :)

Copy link
Contributor

@AxelPeter AxelPeter left a comment

Choose a reason for hiding this comment

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

I've made some fine tunings and simplification, so it can be good to go for QC.
I've also updated your tests, because their were outdated.

<oui-skeleton></oui-skeleton>
```

### Size
Copy link
Contributor

@neolitec neolitec May 22, 2018

Choose a reason for hiding this comment

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

Maybe size is not the thing we want.
Typically the skeleton graphically represents a text we don't know in advance. So the size should be... randomized :)
Maybe the right parameters here should be "min-width" with a default value and eventually "width" / "auto" if we want to force the width... ?
In my opinion, "min-width" to 30% by default for example so that the skeleton always take between 30% and 100% of the width.
@AxelPeter what do you think about?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice idea. But I don't think it's the case for all uses.
We can even have both with an attribute "randomized" for example :)

In fact, I'm not a fan of replacing style="width: 80%" just by width="80%". That's why by default, I let the skeleton with auto to let the user set its width.

I'll check to add your idea

varun257 and others added 6 commits May 28, 2018 14:14
add oui skeleton component
add examples and test case

cui skeleton to oui
add default parameter
bind loading in readme

cui skeleton to oui
remove controllerAs
ng if used instead of ng show

cui skeleton to oui
remove loading in skeleton
remove width calculation
add size attr to skeleton

cui skeleton to oui
@AxelPeter AxelPeter merged commit d2d9d1b into develop Jun 4, 2018
@AxelPeter AxelPeter deleted the feature/oui-skeleton branch June 4, 2018 12:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

5 participants