Skip to content

Commit d4a9d48

Browse files
committed
refactor: Minor
1 parent 0d373e1 commit d4a9d48

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@
2626
<label for="name" class="is-float-label bg-white text-gray-700">Name</label>
2727
</div>
2828
<div class="has-float-label">
29-
<label for="Login" class="is-float-label bg-white text-gray-700">Login</label>
29+
<label for="Login" class="is-float-label bg-white text-gray-700"
30+
>Login (Always visible)</label
31+
>
3032
<input
3133
type="text"
3234
id="Login"
3335
autocomplete="off"
3436
placeholder="Login"
3537
class="control-with-float-label outline-none focus:shadow-outline border w-full px-1 text-base"
36-
value="Login"
38+
value=""
3739
/>
3840
</div>
3941
<div class="has-float-label">

src/index.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
import { DeepPartial } from 'simplytyped';
22

3-
const defaultConfig = {
4-
control: 'pt-2 pb-1',
5-
label: {
6-
...toObject('leading-none text-xs px-1'),
7-
top: 'calc(-0.125rem * 3)',
8-
left: '0.25rem',
9-
},
10-
};
11-
123
export type Options = {
134
/**
145
* Custom styles for container.
@@ -27,7 +18,18 @@ export type Options = {
2718
module.exports = floatLabelFactory;
2819

2920
export default function floatLabelFactory(options?: Options) {
30-
const config: Options = { ...defaultConfig, ...options };
21+
const config: Options = Object.assign(
22+
{},
23+
{
24+
control: 'py-1', // after pt-2
25+
label: {
26+
...toObject('leading-none text-xs px-1'),
27+
top: 'calc(-0.125rem * 3)',
28+
left: '0.25rem',
29+
},
30+
},
31+
options,
32+
);
3133

3234
return ({ addComponents }) => {
3335
const container = config.container ? toObject(config.container) : {};

0 commit comments

Comments
 (0)