-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
851687d
commit c69b500
Showing
15 changed files
with
538 additions
and
20 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
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,22 @@ | ||
import Service from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class StackProviderService extends Service { | ||
stack = []; | ||
|
||
@action | ||
hasOpenChild(dialog) { | ||
return this.stack[this.stack.length - 1] !== dialog.guid; | ||
} | ||
|
||
@action | ||
remove(dialog) { | ||
let ix = this.stack.findIndex((guid) => guid === dialog.guid); | ||
this.stack.splice(ix, 1); | ||
} | ||
|
||
@action | ||
push(dialog) { | ||
this.stack.push(dialog.guid); | ||
} | ||
} |
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 @@ | ||
export { default } from 'ember-headlessui/services/stack-provider'; |
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,49 @@ | ||
{{#let (hash value=false) as |childState|}} | ||
<Dialog | ||
class='fixed inset-0 z-10 overflow-y-auto' | ||
@as='div' | ||
@isOpen={{@isOpen}} | ||
@onClose={{@onClose}} | ||
as |dialog| | ||
> | ||
<div | ||
class='flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0' | ||
> | ||
<dialog.Overlay class='fixed inset-0' /> | ||
|
||
<div | ||
class='inline-block px-4 pt-5 pb-4 overflow-hidden text-left align-bottom bg-white rounded-lg shadow-xl transform transition-all sm:my-{{mult | ||
8 | ||
@level | ||
}} | ||
sm:align-middle sm:max-w-sm sm:w-full sm:p-6 sm:ml-{{mult 8 @level}}' | ||
> | ||
|
||
<div class='mt-3 text-center sm:mt-5'> | ||
<p>Level: {{@level}}</p> | ||
<button | ||
type='button' | ||
class='inline-flex items-center px-4 py-2 text-base font-medium text-white bg-indigo-600 border border-transparent rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500' | ||
{{on 'click' (set childState.value true)}} | ||
>Open {{inc @level}} a</button> | ||
<button | ||
type='button' | ||
class='inline-flex items-center px-4 py-2 text-base font-medium text-white bg-indigo-600 border border-transparent rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500' | ||
{{on 'click' (set childState.value true)}} | ||
>Open {{inc @level}} b</button> | ||
<button | ||
type='button' | ||
class='inline-flex items-center px-4 py-2 text-base font-medium text-white bg-indigo-600 border border-transparent rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500' | ||
{{on 'click' (set childState.value true)}} | ||
>Open {{inc @level}} c</button> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
<Dialogs::Nested | ||
@isOpen={{childState.value}} | ||
@onClose={{set childState.value false}} | ||
@level={{inc @level}} | ||
/> | ||
</Dialog> | ||
{{/let}} |
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,5 @@ | ||
import { helper } from '@ember/component/helper'; | ||
|
||
export default helper(function inc([value] /*, hash*/) { | ||
return value + 1; | ||
}); |
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,5 @@ | ||
import { helper } from '@ember/component/helper'; | ||
|
||
export default helper(function mult([first, second] /*, hash*/) { | ||
return first * second; | ||
}); |
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 @@ | ||
<div class='flex items-start justify-center w-screen h-full p-12 bg-gray-50'> | ||
{{#let (hash value=false) as |state|}} | ||
<button | ||
type='button' | ||
class='inline-flex items-center px-4 py-2 text-base font-medium text-white bg-indigo-600 border border-transparent rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500' | ||
{{on 'click' (set state.value true)}} | ||
> | ||
open 1 | ||
</button> | ||
<Dialogs::Nested | ||
@isOpen={{state.value}} | ||
@onClose={{set state.value false}} | ||
@level={{1}} | ||
/> | ||
{{/let}} | ||
</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
Oops, something went wrong.