-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move to template imports in core component
- Loading branch information
1 parent
4683967
commit 970f046
Showing
15 changed files
with
322 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
module.exports = require('@underline/eslint-config/.prettierrc.js'); | ||
const defaults = require('@underline/eslint-config/.prettierrc.js'); | ||
module.exports = { | ||
...defaults, | ||
plugins: ['prettier-plugin-ember-template-tag'], | ||
overrides: [ | ||
...defaults.overrides, | ||
{ | ||
files: '*.{js,ts,gjs,gts}', | ||
options: { | ||
singleQuote: true | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
presets: [["@babel/preset-typescript", {onlyRemoveTypeImports: true}]], | ||
Check failure on line 2 in packages/core/babel.config.js GitHub Actions / Tests
|
||
plugins: [ | ||
"@embroider/addon-dev/template-colocation-plugin", | ||
Check failure on line 4 in packages/core/babel.config.js GitHub Actions / Tests
|
||
[ | ||
'babel-plugin-ember-template-compilation', | ||
{ | ||
targetFormat: 'hbs', | ||
compilerPath: 'ember-source/dist/ember-template-compiler', | ||
} | ||
], | ||
["@babel/plugin-proposal-decorators", { "legacy": true }], | ||
Check failure on line 12 in packages/core/babel.config.js GitHub Actions / Tests
Check failure on line 12 in packages/core/babel.config.js GitHub Actions / Tests
|
||
"@babel/plugin-proposal-class-properties", | ||
Check failure on line 13 in packages/core/babel.config.js GitHub Actions / Tests
|
||
"@babel/plugin-transform-class-static-block", | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import Component from '@glimmer/component'; | ||
import { action } from '@ember/object'; | ||
import 'focus-visible/dist/focus-visible.js'; | ||
import { on } from '@ember/modifier'; | ||
import useFrontileClass from '../helpers/use-frontile-class.ts' | ||
import VisuallyHidden from './visually-hidden.ts' | ||
|
||
export interface CloseButtonArgs { | ||
/** | ||
* The title of the close button | ||
* | ||
* @defaultValue 'Close' | ||
*/ | ||
title?: string; | ||
|
||
/** | ||
* The icon size | ||
* | ||
* @defaultValue 'lg' | ||
*/ | ||
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; | ||
|
||
/** | ||
* The function to call when button is clicked | ||
*/ | ||
onClick?: (event: Event) => void; | ||
|
||
/** | ||
* Additional class for close button element | ||
*/ | ||
class?: string; | ||
} | ||
|
||
export interface CloseButtonSignature { | ||
Args: CloseButtonArgs; | ||
Blocks: { | ||
default: [string | null]; | ||
}; | ||
Element: HTMLButtonElement; | ||
} | ||
|
||
export default class CloseButton extends Component<CloseButtonSignature> { | ||
@action handleClick(event: Event): void { | ||
if (typeof this.args.onClick === 'function') { | ||
this.args.onClick(event); | ||
} | ||
} | ||
<template> | ||
<button | ||
type="button" | ||
class={{useFrontileClass "close-button" (if @size @size "md") class=@class}} | ||
...attributes | ||
{{on "click" this.handleClick}} | ||
> | ||
{{#let | ||
(useFrontileClass | ||
"close-button" (if @size @size "md") part="icon" | ||
) as |iconClassName| | ||
}} | ||
{{#if (has-block)}} | ||
{{yield iconClassName}} | ||
{{else}} | ||
<svg | ||
class={{iconClassName}} | ||
aria-hidden="true" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="2" | ||
d="M6 18L18 6M6 6l12 12" | ||
></path> | ||
</svg> | ||
{{/if}} | ||
{{/let}} | ||
|
||
<VisuallyHidden> | ||
{{if @title @title "Close"}} | ||
</VisuallyHidden> | ||
</button> | ||
</template> | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="sr-only" ...attributes> | ||
{{yield}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.