-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
16 changed files
with
229 additions
and
248 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,49 +1,26 @@ | ||
<div id="settings" class="dropdown-modal"> | ||
<div class="settings-section"> | ||
<div class="settings-section-header"> | ||
<h2>Instance</h2> | ||
</div> | ||
<div class="settings-section-content"> | ||
<input | ||
style="width: -webkit-fill-available" | ||
<sl-drawer id="settings" class="settings" placement="start" label="Settings"> | ||
<div> | ||
<form id="instance-form" class="inline"> | ||
<sl-input | ||
id="instance-field" | ||
label="Instance" | ||
type="url" | ||
pattern="https?://.*" | ||
placeholder="https://design.penpot.app/" | ||
value="" | ||
/> | ||
<input id="instance-save" type="button" value="Save" /> | ||
</div> | ||
size="small" | ||
></sl-input> | ||
<sl-button id="instance-save" type="submit" size="small">Save</sl-button> | ||
</form> | ||
|
||
<sl-select id="theme-select" label="Theme" size="small"> | ||
<sl-option value="light">Light</sl-option> | ||
<sl-option value="dark">Dark</sl-option> | ||
<sl-option value="system">System</sl-option> | ||
<sl-option value="tab">Penpot</sl-option> | ||
</sl-select> | ||
</div> | ||
<div class="settings-section"> | ||
<div class="settings-section-header"> | ||
<h2>Theme</h2> | ||
</div> | ||
<div id="theme" class="settings-section-content"> | ||
<select name="theme" id="theme-select"> | ||
<option value="light">Light</option> | ||
<option value="dark">Dark</option> | ||
<option value="system">System</option> | ||
<option value="tab">Penpot</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="settings-section"> | ||
<div class="settings-section-header"> | ||
<h2>Help</h2> | ||
</div> | ||
<div class="settings-section-content"> | ||
<div | ||
style=" | ||
display: flex; | ||
gap: 12px; | ||
justify-content: space-evenly; | ||
flex: auto; | ||
" | ||
> | ||
<a href="#" onclick="window.api.send('OpenHelp')">Help</a> | ||
<a href="#" onclick="window.api.send('OpenOffline')">Selfhost</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<sl-button-group class="footer" label="Help Center"> | ||
<sl-button id="open-docs" href="#" size="small">Documentation</sl-button> | ||
<sl-button id="open-selfhost" href="#" size="small">Selfhost</sl-button> | ||
</sl-button-group> | ||
</sl-drawer> |
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
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,51 @@ | ||
import { | ||
SlButton, | ||
SlDrawer, | ||
} from "../../../node_modules/@shoelace-style/shoelace/cdn/shoelace.js"; | ||
import { getIncludedElement } from "./dom.js"; | ||
|
||
export async function initSettings() { | ||
const { toggleSettingsButton, openDocsButton, openSelfhostButton } = | ||
await getTriggers(); | ||
|
||
toggleSettingsButton?.addEventListener("click", () => toggleSettings()); | ||
openDocsButton?.addEventListener("click", () => window.api.send("OpenHelp")); | ||
openSelfhostButton?.addEventListener("click", () => | ||
window.api.send("OpenOffline"), | ||
); | ||
} | ||
|
||
async function toggleSettings() { | ||
const settingsDrawer = await getIncludedElement( | ||
"#settings", | ||
"#include-settings", | ||
SlDrawer, | ||
); | ||
|
||
if (settingsDrawer?.open) { | ||
settingsDrawer?.hide(); | ||
return; | ||
} | ||
|
||
settingsDrawer?.show(); | ||
} | ||
|
||
async function getTriggers() { | ||
const toggleSettingsButton = await getIncludedElement( | ||
"#toggle-settings", | ||
"#include-controls", | ||
SlButton, | ||
); | ||
const openDocsButton = await getIncludedElement( | ||
"#open-docs", | ||
"#include-settings", | ||
SlButton, | ||
); | ||
const openSelfhostButton = await getIncludedElement( | ||
"#open-selfhost", | ||
"#include-settings", | ||
SlButton, | ||
); | ||
|
||
return { toggleSettingsButton, openDocsButton, openSelfhostButton }; | ||
} |
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.