Skip to content

Commit

Permalink
Add click and edit handling for URL select button
Browse files Browse the repository at this point in the history
  • Loading branch information
Komediruzecki authored and Rokt33r committed Apr 13, 2022
1 parent f385f3a commit dd0aac0
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/cloud/components/Props/Pickers/UrlSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ const UrlSelect = ({

const openSelectorIfEmpty = useCallback(
(e) => {
if (value.trim() === '' || !isValidUrl(value)) {
openSelector(e)
}
openSelector(e)
e.preventDefault()
},
[openSelector, value]
[openSelector]
)

return (
Expand All @@ -110,8 +109,7 @@ const UrlSelect = ({
className='url__button'
tag='div'
>
<Flexbox justifyContent='space-between'>
{labelNode}
<Flexbox justifyContent='flex-end'>
{!isReadOnly && !disabled && (
<Button
variant='bordered'
Expand All @@ -124,21 +122,28 @@ const UrlSelect = ({
)}
</Flexbox>
</PropertyValueButton>
{labelNode}
</UrlSelectContainer>
)
}

export default UrlSelect

const UrlSelectContainer = styled.div`
position: relative;
.url-select__label {
padding: 0px;
position: absolute;
justify-self: center;
top: 50%;
transform: translateY(-50%);
padding: 0 0 0 ${({ theme }) => theme.sizes.spaces.sm}px;
border-radius: 4px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
line-height: 25px;
width: 100%;
&.url-select__label--incorrect {
color: ${({ theme }) => theme.colors.text.subtle};
Expand Down

0 comments on commit dd0aac0

Please sign in to comment.