section card updates

- added `clickable` and non `clickable` styles
- added hover state if it's clickable
- added `labelFor` where it was missing and removed where the card is not clickable
This commit is contained in:
Pavel Laptev 2024-03-08 11:03:22 +01:00 committed by GitButler
parent 6bbf7a8310
commit 0d3c33b821
4 changed files with 32 additions and 8 deletions

View File

@ -39,21 +39,25 @@
</div> </div>
<div class="analytics-settings__actions"> <div class="analytics-settings__actions">
<SectionCard on:click={toggleErrorReporting} orientation="row"> <SectionCard labelFor="errorReportngToggle" on:click={toggleErrorReporting} orientation="row">
<svelte:fragment slot="title">Error reporting</svelte:fragment> <svelte:fragment slot="title">Error reporting</svelte:fragment>
<svelte:fragment slot="body"> <svelte:fragment slot="body">
Toggle reporting of application crashes and errors. Toggle reporting of application crashes and errors.
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="actions"> <svelte:fragment slot="actions">
<Toggle checked={$errorReportingEnabled} on:change={toggleErrorReporting} /> <Toggle
id="errorReportngToggle"
checked={$errorReportingEnabled}
on:change={toggleErrorReporting}
/>
</svelte:fragment> </svelte:fragment>
</SectionCard> </SectionCard>
<SectionCard on:click={toggleMetrics} orientation="row"> <SectionCard labelFor="metricsEnabledToggle" on:click={toggleMetrics} orientation="row">
<svelte:fragment slot="title">Usage metrics</svelte:fragment> <svelte:fragment slot="title">Usage metrics</svelte:fragment>
<svelte:fragment slot="body">Toggle sharing of usage statistics.</svelte:fragment> <svelte:fragment slot="body">Toggle sharing of usage statistics.</svelte:fragment>
<svelte:fragment slot="actions"> <svelte:fragment slot="actions">
<Toggle checked={$metricsEnabled} on:change={toggleMetrics} /> <Toggle id="metricsEnabledToggle" checked={$metricsEnabled} on:change={toggleMetrics} />
</svelte:fragment> </svelte:fragment>
</SectionCard> </SectionCard>

View File

@ -152,7 +152,7 @@
</SectionCard> </SectionCard>
{#if selectedType === 'generated'} {#if selectedType === 'generated'}
<SectionCard labelFor="sshKey" roundedTop={false} roundedBottom={false}> <SectionCard roundedTop={false} roundedBottom={false}>
<TextBox id="sshKey" readonly selectall bind:value={sshKey} wide /> <TextBox id="sshKey" readonly selectall bind:value={sshKey} wide />
<div class="row-buttons"> <div class="row-buttons">
<Button <Button

View File

@ -11,6 +11,7 @@
export let background: SectionCardBackground = undefined; export let background: SectionCardBackground = undefined;
export let noBorder = false; export let noBorder = false;
export let labelFor = ''; export let labelFor = '';
export let disabled = false;
const SLOTS = $$props.$$slots; const SLOTS = $$props.$$slots;
</script> </script>
@ -27,6 +28,8 @@
class:loading={background == 'loading'} class:loading={background == 'loading'}
class:success={background == 'success'} class:success={background == 'success'}
class:error={background == 'error'} class:error={background == 'error'}
class:clickable={labelFor !== ''}
class:disabled
> >
{#if SLOTS.iconSide} {#if SLOTS.iconSide}
<div class="section-card__icon-side"> <div class="section-card__icon-side">
@ -64,7 +67,7 @@
border-left: 1px solid var(--clr-theme-container-outline-light); border-left: 1px solid var(--clr-theme-container-outline-light);
border-right: 1px solid var(--clr-theme-container-outline-light); border-right: 1px solid var(--clr-theme-container-outline-light);
background-color: var(--clr-theme-container-light); background-color: var(--clr-theme-container-light);
cursor: pointer; cursor: default;
transition: transition:
background-color var(--transition-fast), background-color var(--transition-fast),
border-color var(--transition-fast); border-color var(--transition-fast);
@ -122,4 +125,21 @@
.no-border { .no-border {
border: none; border: none;
} }
.clickable {
cursor: pointer;
&:hover {
background-color: color-mix(
in srgb,
var(--clr-theme-container-light),
var(--darken-tint-extralight)
);
}
}
.disabled {
pointer-events: none;
opacity: 0.5;
}
</style> </style>

View File

@ -236,7 +236,7 @@
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="actions"> <svelte:fragment slot="actions">
<Toggle <Toggle
id="commiterSigning" id="committerSigning"
checked={annotateCommits} checked={annotateCommits}
on:change={toggleCommitterSigning} on:change={toggleCommitterSigning}
/> />
@ -275,7 +275,7 @@
</div> </div>
</SectionCard> </SectionCard>
<SectionCard labelFor="signingSetting" orientation="row"> <SectionCard labelFor="signingSetting" orientation="row" for="signingSetting">
<svelte:fragment slot="title">Sign Commits with the above SSH Key</svelte:fragment> <svelte:fragment slot="title">Sign Commits with the above SSH Key</svelte:fragment>
<svelte:fragment slot="body"> <svelte:fragment slot="body">
If you want GitButler to sign your commits with the SSH key we generated, then you can add If you want GitButler to sign your commits with the SSH key we generated, then you can add