Skip to content

Commit

Permalink
added new <RegistryYield /> component which can render items or com…
Browse files Browse the repository at this point in the history
…ponents from a registry to UI
  • Loading branch information
roncodes committed Aug 6, 2024
1 parent 66b577f commit 876ee8e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addon/components/registry-yield.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#each this.components as |component|}}
{{yield component @context}}
{{/each}}
9 changes: 9 additions & 0 deletions addon/components/registry-yield.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';

export default class RegistryYieldComponent extends Component {
@service universe;
get components() {
return this.universe.getRenderableComponentsFromRegistry(this.args.registry) ?? [];
}
}
8 changes: 8 additions & 0 deletions addon/styles/components/tip-tap-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ body[data-theme='dark'] .tip-tap-editor > div.tiptap[contenteditable='true'] pre
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
gap: 0.25rem;
padding: 0.25rem;
border-bottom: 1px #e2e8f0 solid;
Expand Down Expand Up @@ -189,6 +190,7 @@ body[data-theme='dark'] .tip-tap-editor > .tip-tap-editor-controls {
.tip-tap-editor > .tip-tap-editor-controls > .tip-tap-editor-control-group {
display: flex;
flex-direction: row;
align-items: flex-start;
padding: 0.15rem 0.2rem;
border-radius: 0.25rem;
background-color: #e2e8f0;
Expand Down Expand Up @@ -249,10 +251,16 @@ body[data-theme='dark'] .tip-tap-editor > .tip-tap-editor-controls > .tip-tap-ed

.tip-tap-editor > .tip-tap-editor-controls > .tip-tap-editor-control-group > .btn-wrapper {
box-shadow: none;
margin-bottom: 0;
}

.tip-tap-editor > .tip-tap-editor-controls > .tip-tap-editor-control-group > label.file-upload.btn-wrapper {
height: 22.8px;
}

.tip-tap-editor > .tip-tap-editor-controls > .btn-wrapper {
box-shadow: none;
margin-bottom: 0;
}

.tip-tap-editor > .tip-tap-editor-controls > .btn-wrapper > a.tip-tap-control-button,
Expand Down
1 change: 1 addition & 0 deletions app/components/registry-yield.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '@fleetbase/ember-ui/components/registry-yield';
26 changes: 26 additions & 0 deletions tests/integration/components/registry-yield-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dummy/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | registry-yield', function (hooks) {
setupRenderingTest(hooks);

test('it renders', async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`<RegistryYield />`);

assert.dom().hasText('');

// Template block usage:
await render(hbs`
<RegistryYield>
template block text
</RegistryYield>
`);

assert.dom().hasText('template block text');
});
});

0 comments on commit 876ee8e

Please sign in to comment.