Skip to content

feat: popover elevation [UX-189] #1682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions components/calendar/src/calendar-input/calendar-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
validateDateString,
} from '@dhis2/multi-calendar-dates'
import { Button } from '@dhis2-ui/button'
import { Card } from '@dhis2-ui/card'
import { InputField } from '@dhis2-ui/input'
import { Layer } from '@dhis2-ui/layer'
import { Popper } from '@dhis2-ui/popper'
Expand Down Expand Up @@ -184,12 +183,10 @@ export const CalendarInput = ({
placement="bottom-start"
modifiers={[offsetModifier]}
>
<Card>
<CalendarContainer
{...calendarProps}
calendarRef={calendarRef}
/>
</Card>
<CalendarContainer
{...calendarProps}
calendarRef={calendarRef}
/>
</Popper>
</Layer>
)}
Expand Down
7 changes: 2 additions & 5 deletions components/calendar/src/calendar/calendar-container.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { colors } from '@dhis2/ui-constants'
import { elevations } from '@dhis2/ui-constants'
import PropTypes from 'prop-types'
import React, { useMemo } from 'react'
import { CalendarTable, CalendarTableProps } from './calendar-table.js'
Expand All @@ -7,7 +7,6 @@ import {
NavigationContainerProps,
} from './navigation-container.js'

const wrapperBorderColor = colors.grey300
const backgroundColor = 'none'

export const CalendarContainer = React.memo(function CalendarContainer({
Expand Down Expand Up @@ -82,12 +81,10 @@ export const CalendarContainer = React.memo(function CalendarContainer({
background-color: ${backgroundColor};
display: flex;
flex-direction: column;
border: 1px solid ${wrapperBorderColor};
border-radius: 3px;
min-width: ${width};
width: max-content;
box-shadow: 0px 4px 6px -2px #2129340d;
box-shadow: 0px 10px 15px -3px #2129341a;
box-shadow: ${elevations.popover};
}
`}</style>
</div>
Expand Down
3 changes: 1 addition & 2 deletions components/menu/src/flyout-menu/flyout-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ const FlyoutMenu = ({
<style jsx>{`
div {
background: ${colors.white};
border: 1px solid ${colors.grey200};
border-radius: 3px;
box-shadow: ${elevations.e300};
box-shadow: ${elevations.popover};
display: inline-block;
min-width: ${dense ? '128' : '180'}px;
max-width: ${maxWidth};
Expand Down
2 changes: 1 addition & 1 deletion components/popover/src/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Popover = ({
arrow = true,
className,
dataTest = 'dhis2-uicore-popover',
elevation = elevations.e200,
elevation = elevations.popover,
maxWidth = 360,
observePopperResize,
observeReferenceResize,
Expand Down
1 change: 0 additions & 1 deletion components/popover/src/popover.prod.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default {
args: {
arrow: true,
dataTest: 'dhis2-uicore-popover',
elevation: elevations.e200,
maxWidth: 360,
placement: 'top',
},
Expand Down
2 changes: 1 addition & 1 deletion components/select/src/select/menu-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MenuWrapper = ({
background: ${colors.white};
border: 1px solid ${colors.grey200};
border-radius: 3px;
box-shadow: ${elevations.e300};
box-shadow: ${elevations.popover};
}
`}</style>
</div>
Expand Down
2 changes: 2 additions & 0 deletions constants/src/elevations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ export const elevations = {
e200: '0px 0px 1px rgba(33,41,52,0.1), 0px 4px 6px -1px rgba(33,41,52,0.1), 0px 2px 4px -1px rgba(33,41,52,0.06)',
e300: '0px 10px 15px -3px rgba(33,41,52,0.1), 0px 4px 6px -2px rgba(33,41,52,0.05)',
e400: '0px 25px 50px -12px rgba(33, 41, 52, 0.25)',
popover:
'0 4px 12px rgba(12, 14, 16, 0.15), 0 0 0 1px rgba(12, 14, 16, 0.05)',
}
Loading