OSS::Stats::Banner - #700
Conversation
Miexil
left a comment
There was a problem hiding this comment.
Don't have mutch to say here except in the tests, good work
| {{#if @titleInfoCircle}} | ||
| <span {{enable-tooltip title=@titleInfoCircle placement="top"}}> | ||
| <OSS::Icon @icon="fa-info-circle" class="font-color-gray-400" /> | ||
| </span> | ||
| {{/if}} |
There was a problem hiding this comment.
I'm wondering if this one shouldn't be a named-block instead.
IMO it really depends on how often it is used. If we have it in at least 50% of the use-cases, might as well leave it this way; it'll be lighter on the parent caller
@phndiaye wdyt ?
There was a problem hiding this comment.
Yeah I was actually debating with myself yesterday if the info-circle & dropdown should both be wrapped in a title extra actions block.
For now in the redesign, we have 13 banners to update & only 2 contain info-circles 👀
There was a problem hiding this comment.
Personally, i would rather make a slightly more complex/future-proof title arg:
type StatTitle = {
label: ReturnType<typeof IntlService['t']> | string;
tooltip?: ReturnType<typeof IntlService['t']> | string;
}
This way we don't necessarily need a named-block but we still group this as belonging to the title
| <span | ||
| class="oss-stats-banner__title text-ellipsis font-color-gray-600 font-weight-semibold" | ||
| {{enable-tooltip title=@title placement="top" displayOnlyOnOverflow=true}} | ||
| >{{@title}}</span> |
There was a problem hiding this comment.
tiniest nit, can we have the {{@title}} on its own line ?
<span
class="..."
{{enable-tooltip ...}}
>
{{@title}}
</span>
| } | ||
| } | ||
|
|
||
| @container (width <= 900px) { |
There was a problem hiding this comment.
... But you're missing container-type: inline-size in the parent in order to enable this ;)
There was a problem hiding this comment.
| assert.dom('.oss-stats-banner .fa-star').hasAttribute('style', 'color:red'); | ||
| }); | ||
|
|
||
| test('when @titleInfoCircle is defined, it renders an info-circle icon next to the title', async function (assert) { |
There was a problem hiding this comment.
needs a counter test, ie, when not defined, not showing up
| assert.dom('.oss-stats-banner .fa-info-circle').exists(); | ||
| }); | ||
|
|
||
| test('when the dropdown block is defined, it renders its content in the title row', async function (assert) { |
| assert.dom('.oss-stats-banner .test-dropdown').exists(); | ||
| }); | ||
|
|
||
| test('when @loading is false and title/stat values are defined, it renders text instead of skeletons', async function (assert) { |
| import { setupRenderingTest } from 'ember-qunit'; | ||
| import { render } from '@ember/test-helpers'; | ||
|
|
||
| module('Integration | Component | o-s-s/stats/banner', function (hooks) { |
There was a problem hiding this comment.
global comment here, let's move related topics into sub-module, for example:
- Module 'Loading state handling'
-
- when
@loadingis true and no related args or blocks are defined, it renders title/stat skeletons
- when
-
- when
@loadingis true, it renders title/stat skeletons and hides named block content
- when
-
- when
@loadingis false and title/stat values are defined, it renders text instead of skeletons
- when
- module for extraIconConfig
etc
71f317e to
452c703
Compare
phndiaye
left a comment
There was a problem hiding this comment.
Global: kinda late on the wording but what about OSS::Stats::Card rather than Banner ? 🤔 (unless it maps to the Figma wordings of course :()
| {{#if @loading}} | ||
| <OSS::Skeleton @height={{12}} @width={{150}} class="oss-stats-banner__skeleton--title" /> | ||
| {{else}} | ||
| <div class="oss-stats-banner__title-row fx-row fx-gap-px-8 fx-xalign-center"> |
There was a problem hiding this comment.
there is no gap-8 (spotted multiple btw) ^^
also, as there is already a class for it, might as well move the utility classes in there imo (applies to multiple cases below)
There was a problem hiding this comment.
Globally, i would add some data-control-name on the key blocks
| {{#if @titleInfoCircle}} | ||
| <span {{enable-tooltip title=@titleInfoCircle placement="top"}}> | ||
| <OSS::Icon @icon="fa-info-circle" class="font-color-gray-400" /> | ||
| </span> | ||
| {{/if}} |
There was a problem hiding this comment.
Personally, i would rather make a slightly more complex/future-proof title arg:
type StatTitle = {
label: ReturnType<typeof IntlService['t']> | string;
tooltip?: ReturnType<typeof IntlService['t']> | string;
}
This way we don't necessarily need a named-block but we still group this as belonging to the title
| {{#if (has-block "dropdown")}} | ||
| {{yield to="dropdown"}} | ||
| {{/if}} |
There was a problem hiding this comment.
nit: is dropdown the best name here? technically you cannot enforce at all what the consumer will do w/ it ^^ maybe title-suffix named-block instead ? (if others have ideas 🙏🏾 )
| {{#if (and (has-block "extra-badges") (not @loading))}} | ||
| <div class="oss-stats-banner__extra-badges fx-row fx-gap-px-3 fx-xalign-center"> | ||
| {{yield to="extra-badges"}} | ||
| </div> | ||
| {{/if}} |
There was a problem hiding this comment.
can you link a design for this use case? i'm having trouble visualising what it maps to
There was a problem hiding this comment.
integrations badges, already tried out in the implem pr from my slack message 👌
There was a problem hiding this comment.
maybe add it to the storybook also ?
| {{#if (and (has-block "cta") (not @loading))}} | ||
| <div class="oss-stats-banner__cta"> | ||
| {{yield to="cta"}} | ||
| </div> | ||
| {{/if}} |
There was a problem hiding this comment.
wondering... should we keep this a named block or an action: ButtonArgs & { fn: (...args: unknown[]) => unknown (a bit like what we do for OSS::Dialog ? 🤔
There was a problem hiding this comment.
On this one we need to leave it open as a named block, component specs specify that there is a possiblity for secondary actions
| <span class="font-color-gray-900 font-weight-semibold font-size-h3">{{@statValue}}</span> | ||
| {{#if @statExtraInfo}} | ||
| <span class="font-color-gray-500">{{@statExtraInfo}}</span> | ||
| {{/if}} | ||
|
|
||
| {{#if @extraInfoTagConfig}} | ||
| <OSS::Tag | ||
| @label={{@extraInfoTagConfig.label}} | ||
| @skin={{@extraInfoTagConfig.skin}} | ||
| @icon={{@extraInfoTagConfig.icon}} | ||
| @plain={{@extraInfoTagConfig.plain}} | ||
| /> | ||
| {{/if}} |
There was a problem hiding this comment.
in the same logic as above, what about:
type StatValue = {
label: ReturnType<typeof IntlService['t']>, // or value
suffix?: ReturnType<typeof IntlService['t']>,
tags?: TagArgs[] // worst case there is always only one but we support multiple (not mandatory though, could be just `tag`)
}
There was a problem hiding this comment.
This would fit better in the visual or data route i think :)
There was a problem hiding this comment.
moved it to data
| } | ||
| } | ||
|
|
||
| @container (width <= 900px) { |
| } | ||
| } | ||
|
|
||
| @container (width <= 900px) { |
There was a problem hiding this comment.
... But you're missing container-type: inline-size in the parent in order to enable this ;)
| } | ||
| } | ||
|
|
||
| @container (width <= 900px) { |
There was a problem hiding this comment.
| {{yield to="cta"}} | ||
| </div> | ||
| {{/if}} | ||
| </div> |
There was a problem hiding this comment.
question: where is the "normal" / "default" {{ yield }} to pass the leftovers? I might very well be missing something here.
There was a problem hiding this comment.
We don't really need it here, not unless we want to pass other components on the fly but that's a whole other implem IMO ^^
b545648 to
d973661
Compare
What does this PR do?
Introduces a new OSS::Stats::Banner component for flexible KPI/header composition.
Related to: #
What are the observable changes?
Good PR checklist