refactor(form): move reactive assignments

This commit is contained in:
Eric Liu 2019-12-29 19:46:09 -08:00
commit 81cf0680fa
2 changed files with 4 additions and 9 deletions

View file

@ -4,10 +4,8 @@
export let style = undefined; export let style = undefined;
import { cx } from '../../lib'; import { cx } from '../../lib';
$: _class = cx('--form', className);
</script> </script>
<form on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}> <form on:click on:mouseover on:mouseenter on:mouseleave class={cx('--form', className)} {style}>
<slot /> <slot />
</form> </form>

View file

@ -8,20 +8,17 @@
export let style = undefined; export let style = undefined;
import { cx } from '../../lib'; import { cx } from '../../lib';
$: _class = cx('--fieldset', className);
$: _legendClass = cx('--label', className);
</script> </script>
<fieldset <fieldset
data-invalid={invalid ? '' : undefined} data-invalid={invalid || undefined}
class={cx('--fieldset', className)}
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave on:mouseleave
class={_class}
{style}> {style}>
<legend class={_legendClass}>{legendText}</legend> <legend class={cx('--label', className)}>{legendText}</legend>
<slot /> <slot />
{#if message} {#if message}
<div class={cx('--form__requirements')}>{messageText}</div> <div class={cx('--form__requirements')}>{messageText}</div>