Skip to content

Commit

Permalink
fix: fix filter drawer being open below resource action content
Browse files Browse the repository at this point in the history
  • Loading branch information
dziraf committed Jan 24, 2024
1 parent 4bd8378 commit cc2f652
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/frontend/components/routes/resource-action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { NoActionError, NoResourceError } from '../app/error-message.js'
import FilterDrawer from '../app/filter-drawer.js'
import { ActionHeader } from '../app/index.js'
import Wrapper from './utils/wrapper.js'
import { getResourceElementCss } from '../../utils/data-css-name.js'

type PropsFromState = {
resources: Array<ResourceJSON>
Expand All @@ -36,6 +37,8 @@ const ResourceAction: React.FC<Props> = (props) => {
return <NoActionError resourceId={resourceId!} actionName={actionName!} />
}

const contentTag = getResourceElementCss(resource.id, action.name)

if (action.showInDrawer) {
return (
<DrawerPortal width={action.containerWidth}>
Expand All @@ -45,8 +48,8 @@ const ResourceAction: React.FC<Props> = (props) => {
}

return (
<Wrapper width={action.containerWidth} showFilter={action.showFilter}>
<Box flex flexDirection="column">
<Wrapper width={action.containerWidth} showFilter={action.showFilter} data-css={contentTag}>
<Box flex flexDirection="column" flexGrow={1}>
<ActionHeader
resource={resource}
action={action}
Expand All @@ -55,7 +58,7 @@ const ResourceAction: React.FC<Props> = (props) => {
/>
<BaseActionComponent action={action} resource={resource} setTag={setTag} />
</Box>
{action.showFilter ? <FilterDrawer resource={resource} /> : ''}
{action.showFilter && <FilterDrawer resource={resource} />}
</Wrapper>
)
}
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/components/routes/utils/wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import allowOverride from '../../../hoc/allow-override.js'

const StyledWrapperWithFilter = styled(Box)`
& > ${Drawer} {
position: relative;
box-shadow: none;
border-radius: ${({ theme }) => theme.space.sm};
}
Expand Down

0 comments on commit cc2f652

Please sign in to comment.