-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6711895
commit 9935854
Showing
4 changed files
with
171 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ $y: 38px; | |
} | ||
|
||
.item-btn { | ||
height: 30px; | ||
width: 100%; | ||
margin: 0; | ||
padding: 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import React from 'react'; | ||
|
||
import { useTitleHooks, useColorDropdownHooks, useOptionsDropdownLibraryHooks } from './hooks'; | ||
|
||
import ColorDropdown from '../../components-shared/Dropdowns/ColorDropdown'; | ||
import ActionDropdown from '../../components-shared/Dropdowns/ActionDropdown'; | ||
|
||
import './Card.scss'; | ||
import '../../styles/colors.scss'; | ||
import OpenColorBlackIcon from '../../assets/icons/rounded-square.svg'; | ||
import OpenColorWhiteIcon from '../../assets/icons/rounded-square-white.svg'; | ||
import DropdownArrowBlackIcon from '../../assets/icons/dropdown-arrow.svg'; | ||
import DropdownArrowWhiteIcon from '../../assets/icons/dropdown-arrow-white.svg'; | ||
|
||
const LibraryTitle = ({ | ||
cardId, | ||
setEditingCard, | ||
}) => { | ||
|
||
const { | ||
inputClassName, | ||
readOnly, | ||
titleRef, | ||
titleValue, | ||
changeTitleValue, | ||
beginTitleEdit, | ||
endTitleEdit, | ||
handleTitleKeyPress, | ||
} = useTitleHooks({ | ||
cardId, | ||
setEditingCard, | ||
}); | ||
|
||
const { | ||
color, | ||
colorDropdownBtnRef, | ||
isColorDropdownOpen, | ||
isLightColor, | ||
closeColorDropdown, | ||
openColorDropdown, | ||
updateColor, | ||
} = useColorDropdownHooks({ cardId }); | ||
|
||
const { | ||
isOptionDropdownOpen, | ||
options, | ||
optionDropdownBtnRef, | ||
closeOptionsDropdown, | ||
openOptionsDropdown, | ||
} = useOptionsDropdownLibraryHooks({ | ||
beginTitleEdit, | ||
cardId, | ||
}); | ||
|
||
return ( | ||
<div className={'title ' + color}> | ||
<div className={'input-div' + (isLightColor ? ' dark' : ' light')}> | ||
<input | ||
className={inputClassName} | ||
maxLength='50' | ||
onBlur={endTitleEdit} | ||
onChange={(e) => changeTitleValue(e.target.value)} | ||
onDoubleClick={beginTitleEdit} | ||
onDragOver={(e) => e.preventDefault()} | ||
onKeyDown={handleTitleKeyPress} | ||
readOnly={readOnly} | ||
ref={titleRef} | ||
title={titleValue} | ||
type='text' | ||
value={titleValue} | ||
/> | ||
</div> | ||
<button | ||
className='color-btn' | ||
onClick={openColorDropdown} | ||
ref={colorDropdownBtnRef} | ||
> | ||
<img src={isLightColor ? OpenColorBlackIcon : OpenColorWhiteIcon} /> | ||
</button> | ||
<ColorDropdown | ||
cardId={cardId} | ||
btnRef={colorDropdownBtnRef} | ||
cardColor={color} | ||
isOpen={isColorDropdownOpen} | ||
onClose={closeColorDropdown} | ||
onUpdateColor={updateColor} | ||
/> | ||
<button | ||
className='dropdown-btn' | ||
ref={optionDropdownBtnRef} | ||
onClick={openOptionsDropdown} | ||
> | ||
<img src={isLightColor ? DropdownArrowBlackIcon : DropdownArrowWhiteIcon} /> | ||
</button> | ||
<ActionDropdown | ||
btnRef={optionDropdownBtnRef} | ||
isOpen={isOptionDropdownOpen} | ||
onClose={closeOptionsDropdown} | ||
items={options} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LibraryTitle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters