-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into CS-7722-implement-account-side-panel-design
- Loading branch information
Showing
21 changed files
with
497 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
126 changes: 126 additions & 0 deletions
126
packages/experiments-realm/components/entity-icon-display.gts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import GlimmerComponent from '@glimmer/component'; | ||
import { concat } from '@ember/helper'; | ||
|
||
interface EntityDisplayWithIconArgs { | ||
Args: { | ||
title?: string; //prefer using args.title if the title is just a string | ||
center?: boolean; | ||
underline?: boolean; | ||
}; | ||
Blocks: { | ||
title?: []; //we can choose use this to pass instead of using args.title if the title block HTML is complex | ||
icon?: []; | ||
tag?: []; | ||
content?: []; | ||
}; | ||
Element: HTMLElement; | ||
} | ||
|
||
export default class EntityDisplayWithIcon extends GlimmerComponent<EntityDisplayWithIconArgs> { | ||
get shouldAlignCenter() { | ||
return this.args.center; | ||
} | ||
|
||
get shouldUnderlineText() { | ||
return this.args.underline; | ||
} | ||
|
||
<template> | ||
<div | ||
class={{concat | ||
'entity-icon-display' | ||
(if this.shouldAlignCenter ' center') | ||
}} | ||
...attributes | ||
> | ||
{{#if (has-block 'icon')}} | ||
<aside class='entity-icon'> | ||
{{yield to='icon'}} | ||
</aside> | ||
{{/if}} | ||
|
||
<div class='entity-info'> | ||
{{! Title and tag }} | ||
<div class='entity-title-tag-container'> | ||
{{! this guard clause is already priotize yield to 'title' instead of using args.title if both are provided}} | ||
{{#if (has-block 'title')}} | ||
{{yield to='title'}} | ||
{{else if @title}} | ||
<span | ||
class={{concat | ||
'entity-title' | ||
(if this.shouldUnderlineText ' underline') | ||
}} | ||
> | ||
{{@title}} | ||
</span> | ||
{{/if}} | ||
|
||
{{#if (has-block 'tag')}} | ||
{{yield to='tag'}} | ||
{{/if}} | ||
</div> | ||
|
||
{{! Extra Content }} | ||
{{#if (has-block 'content')}} | ||
<div class='entity-content'> | ||
{{yield to='content'}} | ||
</div> | ||
{{/if}} | ||
</div> | ||
|
||
</div> | ||
<style scoped> | ||
.entity-icon-display { | ||
--icon-size: var(--entity-display-icon-size, var(--boxel-icon-sm)); | ||
--title-font-size: var( | ||
--entity-display-title-font-size, | ||
var(--boxel-font-size-sm) | ||
); | ||
--content-font-size: var( | ||
--entity-display-content-font-size, | ||
var(--boxel-font-size-xs) | ||
); | ||
--content-color: var(--entity-display-content-color, var(--boxel-400)); | ||
--content-gap: var(--entity-display-content-gap, var(--boxel-sp-xxxs)); | ||
display: flex; | ||
align-items: flex-start; | ||
gap: var(--content-gap); | ||
} | ||
.entity-icon-display.center { | ||
align-items: center; | ||
} | ||
.entity-icon { | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-shrink: 0; | ||
width: var(--icon-size); | ||
height: var(--icon-size); | ||
} | ||
.entity-info { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--content-gap); | ||
} | ||
.entity-title-tag-container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
gap: var(--content-gap); | ||
} | ||
.entity-title { | ||
word-break: break-word; | ||
font-size: var(--title-font-size); | ||
} | ||
.entity-title.underline { | ||
text-decoration: underline; | ||
} | ||
.entity-content { | ||
margin: 0; | ||
font-size: var(--content-font-size); | ||
color: var(--content-color); | ||
} | ||
</style> | ||
</template> | ||
} |
Oops, something went wrong.