Skip to content

Commit

Permalink
null value
Browse files Browse the repository at this point in the history
  • Loading branch information
burieberry committed Jan 21, 2025
1 parent 73d4743 commit 4255d1e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import IconButton from '../icon-button/index.gts';

interface Signature {
Args: {
color: string;
onChange: (color: string) => void;
color: string | null;
onChange: (color: string | null) => void;
};
Element: HTMLDivElement;
}
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class ColorPalette extends Component<Signature> {
@width='16px'
@height='16px'
class='remove'
{{on 'click' (fn @onChange '')}}
{{on 'click' (fn @onChange null)}}
aria-label='Unset color'
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
import ColorPalette from './index.gts';

export default class ColorPaletteUsage extends Component {
@tracked color = '';
@tracked color: string | null = null;

private handleColorChange = (newColor: string) => {
private handleColorChange = (newColor: string | null) => {
this.color = newColor;
};

Expand Down
4 changes: 2 additions & 2 deletions packages/boxel-ui/addon/src/components/color-picker/index.gts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import Component from '@glimmer/component';

interface Signature {
Args: {
color: string;
color: string | null;
disabled?: boolean;
onChange: (color: string) => void;
onChange: (color: string | null) => void;
showHexString?: boolean;
};
Element: HTMLDivElement;
Expand Down
4 changes: 2 additions & 2 deletions packages/boxel-ui/addon/src/components/color-picker/usage.gts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
import ColorPicker from './index.gts';

export default class ColorPickerUsage extends Component {
@tracked color = '';
@tracked color: string | null = null;
@tracked disabled = false;
@tracked showHexString = true;

private onChange = (newColor: string) => {
private onChange = (newColor: string | null) => {
this.color = newColor;
};

Expand Down
18 changes: 16 additions & 2 deletions packages/experiments-realm/blog-post.gts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class EmbeddedTemplate extends Component<typeof BlogPost> {
.categories {
margin-top: var(--boxel-sp);
display: flex;
flex-wrap: wrap;
gap: var(--boxel-sp-xxxs);
}
.category {
Expand Down Expand Up @@ -215,10 +218,10 @@ class FittedTemplate extends Component<typeof BlogPost> {
height: 20px;
margin-left: 7px;
display: none;
overflow: hidden;
}
.category {
font-size: 0.6rem;
height: 20px;
padding: 3px 4px;
border-radius: var(--boxel-border-radius-sm);
Expand Down Expand Up @@ -710,7 +713,11 @@ export class BlogPost extends CardDef {
{{/if}}
{{#if @model.categories.length}}
<div class='categories'>
<@fields.categories @format='atom' @displayContainer={{false}} />
{{#each @model.categories as |category|}}
<div class='category' style={{categoryStyle category}}>
{{category.shortName}}
</div>
{{/each}}
</div>
{{/if}}
<h1><@fields.title /></h1>
Expand Down Expand Up @@ -841,6 +848,13 @@ export class BlogPost extends CardDef {
.featured-image + .categories {
margin-top: var(--boxel-sp-xl);
}
.category {
display: inline-block;
padding: 3px var(--boxel-sp-xxxs);
border-radius: var(--boxel-border-radius-sm);
font: 500 var(--boxel-font-xs);
letter-spacing: var(--boxel-lsp-sm);
}
</style>
</template>
};
Expand Down

0 comments on commit 4255d1e

Please sign in to comment.