-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Feature: Add setting to ignore components #136
base: master
Are you sure you want to change the base?
Changes from 6 commits
7eb709f
b74bf5f
db3f994
4f4fb22
53c4975
3b776fc
450ce70
0703ea6
953bf07
b86cfde
7edd198
9534c78
d3a6c55
f71a464
bf41516
fbb7a0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<div | ||
data-testid="settings-panel" | ||
x-show="settingsPanelOpen" | ||
class="inset-0 absolute flex flex-col items-center justify-center z-max" | ||
> | ||
<div class="absolute bg-alpine-400 opacity-30 inset-0"></div> | ||
<div class="p-4 flex-1 flex items-center justify-center w-full relative z-50" @click="settingsPanelOpen = false"> | ||
<div | ||
x-show.transition.in.opacity="settingsPanelOpen" | ||
class="bg-white w-full h-full p-4 shadow-lg border border-silver-400 relative" | ||
@click.stop | ||
> | ||
<button | ||
data-testid="settings-panel-close-button" | ||
class="absolute top-0 right-0 focus:outline-none block" | ||
@click="settingsPanelOpen = false" | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 20 20" | ||
class="text-black absolute top-1 right-1 w-5 h-5" | ||
fill="currentColor" | ||
> | ||
<path | ||
fill-rule="evenodd" | ||
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" | ||
clip-rule="evenodd" | ||
/> | ||
</svg> | ||
</button> | ||
<div | ||
x-data="{ | ||
pages: [ | ||
{ | ||
name: 'Preferences', | ||
enabled: true, | ||
}, | ||
{ | ||
name: 'Experimental', | ||
enabled: {{ devOnly }}, | ||
} | ||
].filter(p => p.enabled), | ||
active: 'Preferences' | ||
}" | ||
class="flex space-x-4" | ||
> | ||
<div> | ||
<h2 class="text-lg font-light">Settings</h2> | ||
<nav class="flex flex-col items-start text-sm mt-3 text-cool-gray-500 space-y-1"> | ||
<template x-for="page in pages" :key="page.name"> | ||
<button | ||
x-text="page.name" | ||
class="focus:outline-none border-l-8 pl-2 border-transparent" | ||
:class="{ 'border-ice-500': active === page.name }" | ||
@click="active = page.name" | ||
></button> | ||
</template> | ||
</nav> | ||
</div> | ||
<div class="flex-grow"> | ||
@each(page in ['Preferences', 'Experimental'], include = 'settings/pages/' + page.toLowerCase()) | ||
@endeach | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div x-show="active === 'Experimental'"> | ||
<div class="w-full border-b border-cool-gray-200 mb-4 pb-2"> | ||
<h3 class="text-2xl font-light">Experimental</h3> | ||
</div> | ||
<div>Nothing to see here!</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<div x-show="active === 'Preferences'"> | ||
<div class="w-full border-b border-cool-gray-200 mb-2 pb-2"> | ||
<h3 class="text-2xl font-light">Preferences</h3> | ||
</div> | ||
<div class="lg:grid grid-cols-3"> | ||
<div> | ||
<h2 class="uppercase text-sm font-medium mb-3 text-cool-gray-500">Visibility</h2> | ||
<div> | ||
<label for="email" class="block text-sm font-medium text-gray-700">Hidden components</label> | ||
<div class="mt-1"> | ||
<input | ||
type="text" | ||
autocomplete="off" | ||
name="hide-component" | ||
class="p-0.5 px-2 shadow-sm focus:ring-ice-500 focus:border-transparent block w-full sm:text-xs border-gray-300 rounded-md placeholder-cool-gray-400" | ||
placeholder="[x-devtools-ignore]" | ||
aria-describedby="hide-component-description" | ||
/> | ||
</div> | ||
<p class="mt-1 text-xs text-gray-500" id="hide-component-description"> | ||
Hide components using the above selector. | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,7 +15,7 @@ export async function injectPanel(containerNode) { | |||||
// this contains all sorts of CSS tags etc | ||||||
containerNode.innerHTML = rawPanelHtml | ||||||
// keep only the Alpine components in the panel | ||||||
const panelAppHtml = Array.from(containerNode.querySelectorAll('[x-data]')) | ||||||
const panelAppHtml = Array.from(containerNode.querySelectorAll('#devtools-container > [x-data]')) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking this will only work on the simulator. Will see what i can do. It's otherwise duplicating the settings page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about adding Would have to be added to both
and
Should keep the selectors simpler and it matches our use-case (we're selecting using the testid's for dev/testing purposes only) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated now if you want to check it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good to me |
||||||
.map((el) => el.outerHTML) | ||||||
.join('\n') | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HugoDF It doesn't seem like this is hurting anything, but is there something I'm maybe missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there isn't but it might work out better to use testid's on the "root panel components" we want to inject in the simulator (see #136 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized the map is only run in the simulator anyway, so it's not necessary here regardless.