Skip to content

Commit

Permalink
fix: use style hostbinding to fix layout issue stemming from cmdk lib…
Browse files Browse the repository at this point in the history
…rary

cmdk lib is reading this on view init and setting to inline-block if nothing is provided
it uses a style binding which means we cannot override with css classes...
  • Loading branch information
goetzrobin committed Nov 21, 2023
1 parent 3a08f6e commit 25bea0d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/ui/command/helm/src/lib/hlm-command-item.directive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, Input, computed, signal } from '@angular/core';
import { computed, Directive, Input, signal } from '@angular/core';
import { hlm } from '@spartan-ng/ui-core';
import { ClassValue } from 'clsx';

Expand All @@ -7,6 +7,10 @@ import { ClassValue } from 'clsx';
standalone: true,
host: {
'[class]': '_computedClass()',
// This is needed after changes to the underlying CMDK library used for the BrnCommand primitive
// Ideally we would remove the dependency on this outside module. If you are open to that please
// reach out and if you are feeling super ambitious you can implement it yourself and open a PR!
'[style.display]': '"flex"',
},
})
export class HlmCommandItemDirective {
Expand All @@ -19,7 +23,7 @@ export class HlmCommandItemDirective {
protected _computedClass = computed(() => this._generateClass());
private _generateClass() {
return hlm(
'flex items-center relative cursor-default select-none rounded-sm px-2 py-1.5 text-sm outline-none\n' +
'items-center relative cursor-default select-none rounded-sm px-2 py-1.5 text-sm outline-none\n' +
'aria-selected:bg-accent aria-selected:text-accent-foreground\n' +
'hover:bg-accent/50\n' +
'disabled:pointer-events-none disabled:opacity-50',
Expand Down

1 comment on commit 25bea0d

@vercel
Copy link

@vercel vercel bot commented on 25bea0d Nov 21, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

spartan – ./

spartan-git-main-goetzrobin.vercel.app
spartan.ng
www.spartan.ng
spartan-goetzrobin.vercel.app

Please sign in to comment.