Skip to content

Commit

Permalink
fix: make input field as wide as its parent (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusforsberg authored Apr 18, 2024
1 parent 6ec7de5 commit ce90410
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/LinkField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const ValidationErrorWrapper = styled(Box)`
margin-right: 12px;
`

const FullWidthStack = styled(Stack)`
width: 100%;
`

/**
* Custom field component for the link object.
* Nicely renders the type and link fields next to each other, with the
Expand Down Expand Up @@ -55,7 +59,7 @@ export function LinkField(props: ObjectInputProps & {customLinkTypes: CustomLink
return (
<Stack space={4}>
<Stack space={3}>
<Flex gap={2} align="center">
<Flex gap={2} align="flex-start">
{/* Render the type field (without its label) */}
<ObjectInputMember
member={{
Expand All @@ -71,7 +75,7 @@ export function LinkField(props: ObjectInputProps & {customLinkTypes: CustomLink
{...renderProps}
/>

<Stack space={2}>
<FullWidthStack space={2}>
{/* Render the input for the selected type of link (withouts its label) */}
<ObjectInputMember
member={{
Expand All @@ -97,7 +101,7 @@ export function LinkField(props: ObjectInputProps & {customLinkTypes: CustomLink
/>
</ValidationErrorWrapper>
)}
</Stack>
</FullWidthStack>
</Flex>

{/* Render the description of the selected link field, if any */}
Expand Down

0 comments on commit ce90410

Please sign in to comment.