Skip to content

Commit

Permalink
WIP layout
Browse files Browse the repository at this point in the history
  • Loading branch information
seancolsen committed Nov 22, 2023
1 parent 58533d2 commit 4f01514
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
CSS that uses the `:empty` pseudo-class which does not work if there is
white space.
-->
<span class="label"><slot name="label">{label}</slot></span>
<span class="help"><slot name="help">{help}</slot></span>
<span class="label">{label}<slot name="label" /></span>
<span class="help">{help}<slot name="help" /></span>
<span class="input"><slot /></span>
</span>
</Label>
Expand Down
30 changes: 27 additions & 3 deletions mathesar_ui/src/pages/database-connection/GridForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,42 @@
TODO_3311: re-organize this component and resolve naming conflict with other
GridForm component
-->
<div class="grid-form">
<script lang="ts">
/** When the form is wider than this, it will display in a grid. When it's
* narrower, it will display vertically */
export let breakpointPx = 400;
let width: number;
</script>

<div
class="grid-form"
bind:clientWidth={width}
class:grid={width > breakpointPx}
>
<slot />
</div>

<style>
.grid-form {
.grid-form:not(.grid) > :global(* + *) {
margin-top: 1rem;
}
.grid-form:not(.grid) > :global(.divider + .divider) {
display: none;
}
.grid-form:not(.grid) > :global(:nth-child(even)) {
margin-left: 1rem;
margin-bottom: 2rem;
}
.grid-form.grid {
display: grid;
grid-template-columns: fit-content(30%) 1fr;
gap: 1.5rem 0;
}
.grid-form > :global(:nth-child(odd)) {
.grid-form.grid > :global(:nth-child(odd)) {
text-align: right;
padding-right: 1rem;
}
Expand Down

0 comments on commit 4f01514

Please sign in to comment.