Skip to content

Commit

Permalink
Merge branch 'next' into 917-feature-autcomplete-component
Browse files Browse the repository at this point in the history
  • Loading branch information
sabato-galasso committed Oct 5, 2023
2 parents 29b471a + 7f451b8 commit 259d9ce
Showing 1 changed file with 37 additions and 15 deletions.
52 changes: 37 additions & 15 deletions stories/Form/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,29 @@ export const UtilizzoDiPlaceholderELabel = () => (
UtilizzoDiPlaceholderELabel.storyName = 'Utilizzo di placeholder e label';

export const InputConIconaOBottoni = () => {
const [isFocused, toggleFocus] = useState(false);
const [isFocused1, toggleFocus1] = useState(false);
const [isFocused2, toggleFocus2] = useState(false);
const [isFocused3, toggleFocus3] = useState(false);

const toggleFocusLabel = () => toggleFocus(true);
const toggleFocusLabel1 = () => toggleFocus1(true);
// @ts-ignore: ignore types for now
const toggleBlurLabel = (e) => {
const toggleBlurLabel1 = (e) => {
if (e.target.value === '') {
toggleFocus(!isFocused);
toggleFocus1(!isFocused1);
}
};
const toggleFocusLabel2 = () => toggleFocus2(true);
// @ts-ignore: ignore types for now
const toggleBlurLabel2 = (e) => {
if (e.target.value === '') {
toggleFocus2(!isFocused2);
}
};
const toggleFocusLabel3 = () => toggleFocus3(true);
// @ts-ignore: ignore types for now
const toggleBlurLabel3 = (e) => {
if (e.target.value === '') {
toggleFocus3(!isFocused3);
}
};
return (
Expand All @@ -166,14 +182,16 @@ export const InputConIconaOBottoni = () => {
<Icon icon='it-pencil' aria-hidden size='sm' />
</div>
</div>
<label htmlFor='input-group-1' className={isFocused ? 'active' : ''}>
<label htmlFor='input-group-1' className={isFocused1 ? 'active' : ''}>
Con Etichetta
</label>
<input
type='text'
className={isFocused ? 'form-control focus--mouse' : 'form-control'}
onFocus={toggleFocusLabel}
onBlur={toggleBlurLabel}
className={
isFocused1 ? 'form-control focus--mouse' : 'form-control'
}
onFocus={toggleFocusLabel1}
onBlur={toggleBlurLabel1}
id='input-group-1'
name='input-group-1'
/>
Expand All @@ -196,9 +214,11 @@ export const InputConIconaOBottoni = () => {
</label>
<input
type='text'
className={isFocused ? 'form-control focus--mouse' : 'form-control'}
onFocus={toggleFocusLabel}
onBlur={toggleBlurLabel}
className={
isFocused2 ? 'form-control focus--mouse' : 'form-control'
}
onFocus={toggleFocusLabel2}
onBlur={toggleBlurLabel2}
id='input-group-2'
name='input-group-2'
placeholder='Lorem Ipsum'
Expand All @@ -217,14 +237,16 @@ export const InputConIconaOBottoni = () => {
<Icon icon='it-pencil' color='primary' aria-hidden size='sm' />
</div>
</div>
<label htmlFor='input-group-3' className={isFocused ? 'active' : ''}>
<label htmlFor='input-group-3' className={isFocused3 ? 'active' : ''}>
Con Etichetta e bottone di tipo primary
</label>
<input
type='text'
className={isFocused ? 'form-control focus--mouse' : 'form-control'}
onFocus={toggleFocusLabel}
onBlur={toggleBlurLabel}
className={
isFocused3 ? 'form-control focus--mouse' : 'form-control'
}
onFocus={toggleFocusLabel3}
onBlur={toggleBlurLabel3}
id='input-group-3'
name='input-group-3'
/>
Expand Down

0 comments on commit 259d9ce

Please sign in to comment.