Use fieldset for styling form elements

This commit is contained in:
2025-01-27 22:54:47 +01:00
parent 6d7fb71830
commit 4d1680b7f5
11 changed files with 233 additions and 185 deletions

View File

@@ -386,6 +386,22 @@ ul {
list-style: disc; list-style: disc;
} }
fieldset {
padding: 4px;
border-radius: 8px;
border: 2px var(--separator) solid;
margin: 0;
}
fieldset>legend {
padding: 2px 8px;
margin-left: auto;
margin-right: auto;
border-radius: 8px;
font-size: 1.1em;
border-bottom: 2px var(--separator) solid;
}
/* Forms*/ /* Forms*/
.form { .form {

View File

@@ -57,6 +57,13 @@
File <input type="file" name="file"> File <input type="file" name="file">
<hr/> <hr/>
Color <input type="color" name="favcolor" value="#ff0000"> Color <input type="color" name="favcolor" value="#ff0000">
<hr/>
<fieldset>
<legend>Legend</legend>
<p>
Fieldset
</p>
</fieldset>
<br/><br/> <br/><br/>
<iframe src="https://pixeldrain.com/u/Nygt1on4?embed" style="border: none; width: 800px; max-width: 100%; height: 600px; max-height: 100%; border-radius: 16px;"></iframe> <iframe src="https://pixeldrain.com/u/Nygt1on4?embed" style="border: none; width: 800px; max-width: 100%; height: 600px; max-height: 100%; border-radius: 16px;"></iframe>

View File

@@ -147,7 +147,7 @@ const close_socket = () => {
.stat { .stat {
line-height: 1.2em; line-height: 1.2em;
} }
@media (max-width: 800px) { @media (max-width: 1000px) {
.label { .label {
text-align: center; text-align: center;
padding-left: 0; padding-left: 0;

View File

@@ -252,7 +252,7 @@ const download = () => {
/* This max-width needs to be synced with the .toolbar max-width in /* This max-width needs to be synced with the .toolbar max-width in
Toolbar.svelte and the .label max-width in FileStats.svelte */ Toolbar.svelte and the .label max-width in FileStats.svelte */
@media (max-width: 800px) { @media (max-width: 1000px) {
.viewer_area { .viewer_area {
flex-direction: column-reverse; flex-direction: column-reverse;
} }

View File

@@ -56,7 +56,7 @@ const toggle_fullscreen = () => {
} }
} }
let expanded = false let expanded = true
let expand = e => { let expand = e => {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
@@ -188,14 +188,14 @@ let expand = e => {
/* This max-width needs to be synced with the .viewer_area max-width in /* This max-width needs to be synced with the .viewer_area max-width in
Toolbar.svelte and the .label max-width in FileStats.svelte */ Toolbar.svelte and the .label max-width in FileStats.svelte */
@media (max-width: 800px) { @media (max-width: 1000px) {
.toolbar { .toolbar {
overflow-y: hidden; overflow-y: hidden;
max-height: 2.1em; max-height: 2.1em;
} }
.toolbar.expanded { .toolbar.expanded {
overflow-y: scroll; overflow-y: scroll;
max-height: 30vh; max-height: 25vh;
} }
.stats_container { .stats_container {
flex-direction: row; flex-direction: row;
@@ -204,7 +204,6 @@ Toolbar.svelte and the .label max-width in FileStats.svelte */
margin: 2px 0; margin: 2px 0;
} }
.hidden_vertical { .hidden_vertical {
display: block; display: block;
} }

View File

@@ -44,7 +44,8 @@ const del_password = (pass: string) => {
have delete permissions. You can see who the owner of a file is in the have delete permissions. You can see who the owner of a file is in the
Details window. Details window.
</p> </p>
<h2>Link permissions</h2> <fieldset>
<legend>Link permissions</legend>
<div class="row"> <div class="row">
<div class="grow id"> <div class="grow id">
Anyone with the link can... Anyone with the link can...
@@ -53,8 +54,11 @@ const del_password = (pass: string) => {
<PermissionButton bind:permissions={file.link_permissions}/> <PermissionButton bind:permissions={file.link_permissions}/>
</div> </div>
</div> </div>
</fieldset>
<h2>User permissions</h2>
<fieldset>
<legend>User permissions</legend>
<p> <p>
Enter a username here to give them access to this directory. The user will Enter a username here to give them access to this directory. The user will
not receive an e-mail invite. Giving write access to a user without giving not receive an e-mail invite. Giving write access to a user without giving
@@ -80,8 +84,10 @@ const del_password = (pass: string) => {
</div> </div>
{/each} {/each}
{/if} {/if}
</fieldset>
<h2>Password permissions</h2> <fieldset>
<legend>Password permissions</legend>
<p> <p>
Allow users to enter a password to give them access to this directory. Allow users to enter a password to give them access to this directory.
</p> </p>
@@ -108,13 +114,13 @@ const del_password = (pass: string) => {
</div> </div>
{/each} {/each}
{/if} {/if}
</fieldset>
<style> <style>
.row { .row {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
border-bottom: 1px solid var(--separator);
margin-bottom: 2px; margin-bottom: 2px;
padding-bottom: 2px; padding-bottom: 2px;
} }

View File

@@ -77,20 +77,23 @@ const handle_picker = async e => {
let highlight_info = false let highlight_info = false
</script> </script>
<fieldset>
<legend>Enable page branding</legend>
<p> <p>
You can customize how your filesystem looks. The colours chosen here apply You can customize how your filesystem looks. The colours chosen here apply
to the directory you're currently in and all files and directories in this to the directory you're currently in and all files and directories in this
directory. Colours which you do not want to modify can be left empty. Then directory. Colours which you do not want to modify can be left empty. Then
the default theme colour will be used. the default theme colours will be used.
</p> </p>
<div> <div>
<input bind:checked={enabled} id="enable_branding" type="checkbox" class="form_input"/> <input bind:checked={enabled} id="enable_branding" type="checkbox" class="form_input"/>
<label for="enable_branding">Enable custom branding options</label> <label for="enable_branding">Enable custom page branding</label>
</div> </div>
<hr/> </fieldset>
<div class="grid" class:disabled={!enabled}> <fieldset class="grid" disabled={!enabled}>
<legend>Colours</legend>
<div> <div>
<div style="display: inline-block">Highlight</div> <div style="display: inline-block">Highlight</div>
<HelpButton bind:toggle={highlight_info}/> <HelpButton bind:toggle={highlight_info}/>
@@ -120,6 +123,10 @@ let highlight_info = false
<div>Card</div> <div>Card</div>
<input type="color" bind:value={file.properties.brand_card_color}/> <input type="color" bind:value={file.properties.brand_card_color}/>
<input type="text" bind:value={file.properties.brand_card_color}/> <input type="text" bind:value={file.properties.brand_card_color}/>
</fieldset>
<fieldset class="grid" disabled={!enabled}>
<legend>Image customization</legend>
<p class="span3"> <p class="span3">
You can choose an image to show above or behind the files in this You can choose an image to show above or behind the files in this
directory. The image will be picked from your filesystem. The image will directory. The image will be picked from your filesystem. The image will
@@ -141,9 +148,10 @@ let highlight_info = false
Pick Pick
</button> </button>
<input type="text" bind:value={file.properties.brand_background_image}/> <input type="text" bind:value={file.properties.brand_background_image}/>
</div> </fieldset>
<hr/> <fieldset disabled={!enabled}>
<legend>Page preview</legend>
<p> <p>
Below is an example of what the site looks like with these colours: Below is an example of what the site looks like with these colours:
</p> </p>
@@ -175,6 +183,7 @@ let highlight_info = false
</div> </div>
</div> </div>
</div> </div>
</fieldset>
<FilePicker bind:this={picker} on:files={handle_picker}/> <FilePicker bind:this={picker} on:files={handle_picker}/>
@@ -195,7 +204,7 @@ input[type="color"] {
.span3 { .span3 {
grid-column: span 3; grid-column: span 3;
} }
.disabled { fieldset:disabled {
filter: opacity(40%); filter: opacity(40%);
} }

View File

@@ -34,7 +34,8 @@ const delete_file = async e => {
} }
</script> </script>
<h2>File settings</h2> <fieldset>
<legend>File settings</legend>
{#if is_root_dir} {#if is_root_dir}
<div class="highlight_yellow"> <div class="highlight_yellow">
Filesystem root cannot be renamed. If this shared directory Filesystem root cannot be renamed. If this shared directory
@@ -47,13 +48,17 @@ const delete_file = async e => {
<label for="file_name">Name</label> <label for="file_name">Name</label>
<input form="edit_form" bind:value={new_name} id="file_name" type="text" class="form_input" disabled={is_root_dir}/> <input form="edit_form" bind:value={new_name} id="file_name" type="text" class="form_input" disabled={is_root_dir}/>
</div> </div>
</fieldset>
{#if $nav.permissions.delete === true} {#if $nav.permissions.delete === true}
<h2>Delete</h2> <fieldset>
<legend>Delete</legend>
<p> <p>
Delete this file or directory. If this is a directory then all Delete this file or directory. If this is a directory then all
subfiles will be deleted as well. This action cannot be undone. subfiles will be deleted as well. This action cannot be undone.
</p> </p>
<Button click={delete_file} red icon="delete" label="Delete" style="align-self: flex-start;"/> <Button click={delete_file} red icon="delete" label="Delete" style="align-self: flex-start;"/>
</fieldset>
{/if} {/if}
<style> <style>

View File

@@ -24,7 +24,7 @@ let embed_iframe = file => {
let url = domain_url()+"/d/"+file.id let url = domain_url()+"/d/"+file.id
embed_html = `<iframe ` + embed_html = `<iframe ` +
`src="${url}" ` + `src="${url}" ` +
`style="border: none; width: 800px; max-width: 100%; height: 600px; max-height: 100%; border-radius: 8px; "` + `style="border: none; width: 100%; max-width 90vw; height: 800px; max-height: 75vh; border-radius: 6px; "` +
`allowfullscreen` + `allowfullscreen` +
`></iframe>` `></iframe>`
} }
@@ -52,7 +52,8 @@ const update_shared = e => {
} }
</script> </script>
<h2>Share this file/directory</h2> <fieldset>
<legend>Public link</legend>
{#if file.abuse_type !== undefined} {#if file.abuse_type !== undefined}
<div class="highlight_red"> <div class="highlight_red">
@@ -88,8 +89,10 @@ const update_shared = e => {
<CopyButton text={share_link}>Copy</CopyButton> <CopyButton text={share_link}>Copy</CopyButton>
{/if} {/if}
</div> </div>
</fieldset>
<h2>Embedding</h2> <fieldset>
<legend>Embedding</legend>
<p> <p>
If you have a website you can embed pixeldrain directories and files in your If you have a website you can embed pixeldrain directories and files in your
own webpages with the code below. If you embed a directory then all own webpages with the code below. If you embed a directory then all
@@ -97,8 +100,6 @@ const update_shared = e => {
options will also apply in the frame, but only when applied to this options will also apply in the frame, but only when applied to this
directory. It will not inherit the style from parent directories. directory. It will not inherit the style from parent directories.
</p> </p>
<h3>Code</h3>
<p> <p>
Put this code in your website to embed the file or directory. Put this code in your website to embed the file or directory.
</p> </p>
@@ -110,8 +111,10 @@ const update_shared = e => {
<i class="icon">visibility</i> Show example <i class="icon">visibility</i> Show example
</button> </button>
</div> </div>
<hr/>
<div bind:this={preview_area} style="text-align: center;"></div> <div bind:this={preview_area} style="text-align: center;"></div>
</fieldset>
<style> <style>
.center { .center {

View File

@@ -408,7 +408,6 @@ onMount(() => {
padding: 0; padding: 0;
background: var(--shaded_background); background: var(--shaded_background);
backdrop-filter: blur(4px); backdrop-filter: blur(4px);
z-index: 1;
} }
.toolbar { .toolbar {
display: flex; display: flex;

View File

@@ -16,7 +16,7 @@ export let hide_branding = false
<tr> <tr>
<td></td> <td></td>
<td>Name</td> <td>Name</td>
<td>Size</td> <td class="hide_small">Size</td>
<td></td> <td></td>
</tr> </tr>
{#each $nav.children as child, index (child.path)} {#each $nav.children as child, index (child.path)}
@@ -34,7 +34,7 @@ export let hide_branding = false
<td class="node_name"> <td class="node_name">
{child.name} {child.name}
</td> </td>
<td class="node_size"> <td class="node_size hide_small">
{#if child.type === "file"} {#if child.type === "file"}
{formatDataVolume(child.file_size, 3)} {formatDataVolume(child.file_size, 3)}
{/if} {/if}
@@ -73,7 +73,6 @@ export let hide_branding = false
display: table; display: table;
margin: 8px auto 16px auto; margin: 8px auto 16px auto;
background: var(--shaded_background); background: var(--shaded_background);
backdrop-filter: blur(4px);
border-collapse: collapse; border-collapse: collapse;
border-radius: 8px; border-radius: 8px;
@@ -139,4 +138,9 @@ td {
width: 64px; width: 64px;
} }
} }
@media (max-width: 500px) {
.hide_small {
display: none;
}
}
</style> </style>