Skip to content

Commit ecd77a9

Browse files
authored
Merge pull request #2494 from hashicorp/showcase-gts/frame
Showcase `.gts` - `Shw::Frame`
2 parents e83460a + 7657187 commit ecd77a9

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

showcase/app/components/shw/frame/index.ts showcase/app/components/shw/frame/index.gts

+34
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import Component from '@glimmer/component';
77
import { assert } from '@ember/debug';
88
import { htmlSafe } from '@ember/template';
99

10+
import ShwLabel from '../label';
11+
import HdsIcon from '@hashicorp/design-system-components/components/hds/icon/index';
12+
1013
import type { SafeString } from '@ember/template';
1114

1215
interface ShwFrameSignature {
@@ -84,4 +87,35 @@ export default class ShwFrameComponent extends Component<ShwFrameSignature> {
8487

8588
return styles.length > 0 ? htmlSafe(styles.join('; ')) : undefined;
8689
}
90+
91+
<template>
92+
<div class="shw-frame" style={{this.style}}>
93+
{{#if @label}}
94+
<ShwLabel>{{@label}}</ShwLabel>
95+
{{/if}}
96+
<div class="shw-frame__browser">
97+
<div class="shw-frame__browser-navigation">
98+
<a
99+
class="shw-frame__open-link"
100+
href={{this.src}}
101+
target="_blank"
102+
rel="noopener noreferrer"
103+
>
104+
<HdsIcon @name="external-link" @stretched={{true}} />
105+
<span class="sr-only">open the frame in a new window</span>
106+
</a>
107+
</div>
108+
<iframe
109+
id={{@id}}
110+
class="shw-frame__browser-viewport"
111+
src={{this.src}}
112+
referrerpolicy="no-referrer"
113+
sandbox="allow-same-origin allow-scripts"
114+
loading="lazy"
115+
title={{this.title}}
116+
...attributes
117+
></iframe>
118+
</div>
119+
</div>
120+
</template>
87121
}

showcase/app/components/shw/frame/index.hbs

-28
This file was deleted.

showcase/types/template-registry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import ShwAutoscrollable from '../app/components/shw/autoscrollable/index';
77
import ShwDivider from '../app/components/shw/divider/index';
88
import ShwFlex from '../app/components/shw/flex/index';
99
import ShwFlexItem from '../app/components/shw/flex/item';
10-
import ShwFrame from '../app/components/shw/frame';
10+
import ShwFrame from '../app/components/shw/frame/index';
1111
import ShwGrid from '../app/components/shw/grid';
1212
import ShwGridItem from '../app/components/shw/grid/item';
1313
import ShwLabel from '../app/components/shw/label/index';

0 commit comments

Comments
 (0)