Skip to content

Commit 3f9b74a

Browse files
committed
Fix box shadow
1 parent a498900 commit 3f9b74a

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

packages/code-editor/src/SearchForm/SearchForm.styles.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,38 @@ const getBaseContainerStyles = (theme: Theme) => css`
2020
]};
2121
border-bottom-left-radius: ${borderRadius[150]}px;
2222
border-bottom-right-radius: ${borderRadius[150]}px;
23-
box-shadow: ${shadow[theme][100]};
2423
width: 100%;
2524
max-width: ${CONTAINER_MAX_WIDTH}px;
25+
position: relative;
2626
display: grid;
2727
grid-template-rows: ${SECTION_HEIGHT}px 0fr;
28-
overflow: hidden;
2928
transition: grid-template-rows ${transitionDuration.slower}ms ease-in-out;
29+
z-index: 1;
30+
31+
/** Add a shadow to the container while clipping the right edge*/
32+
&::after {
33+
content: '';
34+
35+
/** Position the pseudo-element to match the parent's size and location */
36+
position: absolute;
37+
top: 0;
38+
left: 0;
39+
width: 100%;
40+
height: 100%;
41+
42+
/** Apply the shadow to the pseudo-element */
43+
box-shadow: ${shadow[theme][100]};
44+
45+
/** Negative values expand the clipping area outward, revealing the shadow. */
46+
/** A zero value clips the shadow exactly at the element's edge. */
47+
clip-path: inset(-20px 0px -20px -20px);
48+
49+
/** Match the parent's border-radius for consistency */
50+
border-radius: inherit;
51+
52+
/** Places the pseudo-element behind the parent element */
53+
z-index: -1;
54+
}
3055
`;
3156

3257
const openContainerStyles = css`

0 commit comments

Comments
 (0)