Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Nov 4, 2024
1 parent 47f23ed commit 19a3d7a
Showing 1 changed file with 56 additions and 50 deletions.
106 changes: 56 additions & 50 deletions apps/repl/app/components/limber/share.gts
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,63 @@ const isShowing = cell(false);

const { Boolean } = globalThis;

export class Share extends Component {
export const Share = <template>
<Modal as |m|>
<button data-share-button type="button" {{on "click" m.open}}>
Share
<FaIcon @icon="share-from-square" @prefix="fas" />
</button>

<m.Dialog class="preem" {{focusTrap isActive=m.isOpen}}>
{{#if m.isOpen}}
<ShareModal @onCancel={{m.close}} />
{{/if}}
</m.Dialog>
</Modal>
</template>;

class ShareModal extends Component<{ onCancel: () => void }> {
<template>
<Modal as |m|>
<button data-share-button type="button" {{on "click" m.open}}>
Share
<FaIcon @icon="share-from-square" @prefix="fas" />
</button>

<m.Dialog class="preem" {{focusTrap isActive=m.isOpen}}>
<SaveBanner @isShowing={{isShowing.current}} />

<header><h2>Share</h2>
<FlatButton {{on "click" m.close}} aria-label="close this share modal">
<FaIcon @size="xs" @icon="xmark" class="aspect-square" />
</FlatButton>
</header>
<form {{on "submit" this.handleSubmit}}>
<main>
{{#if this.error}}
<div class="error">{{this.error}}</div>
{{/if}}
<div class="inline-mini-form">
<ReadonlyField
@label="shortened URL"
@value={{this.shortUrl}}
@copyable={{Boolean this.shortUrl}}
placeholder="Click 'Create'"
/>

{{#unless this.shortUrl}}
<button type="submit">Create</button>
{{/unless}}
</div>
<Tip>
<KeyCombo @keys={{array "Ctrl" "S"}} @mac={{array "Command" "S"}} />
will copy a shortened URL to your clipboard.</Tip>
</main>

<footer>
<div class="right">
<div class="buttons">
<button type="button" class="cancel" {{on "click" m.close}}>Close</button>
{{#unless this.shortUrl}}
<button type="submit">Create Link</button>
{{/unless}}
</div>
</div>
</footer>
</form>
</m.Dialog>
</Modal>
<SaveBanner @isShowing={{isShowing.current}} />

<header><h2>Share</h2>
<FlatButton {{on "click" @onCancel}} aria-label="close this share modal">
<FaIcon @size="xs" @icon="xmark" class="aspect-square" />
</FlatButton>
</header>
<form {{on "submit" this.handleSubmit}}>
<main>
{{#if this.error}}
<div class="error">{{this.error}}</div>
{{/if}}
<div class="inline-mini-form">
<ReadonlyField
@label="shortened URL"
@value={{this.shortUrl}}
@copyable={{Boolean this.shortUrl}}
placeholder="Click 'Create'"
/>

{{#unless this.shortUrl}}
<button type="submit">Create</button>
{{/unless}}
</div>
<Tip>
<KeyCombo @keys={{array "Ctrl" "S"}} @mac={{array "Command" "S"}} />
will copy a shortened URL to your clipboard.</Tip>
</main>

<footer>
<div class="right">
<div class="buttons">
<button type="button" class="cancel" {{on "click" @onCancel}}>Close</button>
{{#unless this.shortUrl}}
<button type="submit">Create Link</button>
{{/unless}}
</div>
</div>
</footer>
</form>
</template>

@service declare router: RouterService;
Expand Down

0 comments on commit 19a3d7a

Please sign in to comment.