Skip to content
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

chore(scheduled-publishing): update schedule tool upsell layout #6572

Merged
merged 2 commits into from
May 6, 2024
Merged
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
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
# -- Scheduled Publishing --
/packages/sanity/src/core/scheduledPublishing/ @sanity-io/studio-ex

# -- Upsell UI --
packages/sanity/src/core/studio/upsell/ @sanity-io/studio-ex


# Code and typegeneration
/packages/@sanity/codegen/ @sanity-io/content-lake-dx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Schedules = () => {
{mode === 'upsell' && upsellData && (
<Panel width={1} padding={4} paddingBottom={1}>
<UpsellPanel
layout="vertical"
layout="horizontal"
data={upsellData}
onPrimaryClick={telemetryLogs.panelPrimaryClicked}
onSecondaryClick={telemetryLogs.panelSecondaryClicked}
Expand Down
10 changes: 7 additions & 3 deletions packages/sanity/src/core/studio/upsell/UpsellPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import {type UpsellData} from './types'

type Layout = 'vertical' | 'horizontal'
const Image = styled.img<{$direction: FlexDirection[]}>((props) => {
const {media, radius} = getTheme_v2(props.theme)
const {media} = getTheme_v2(props.theme)

const responsiveStyles = _responsive(media, props.$direction, (val) => {
return {
width: val === 'row' ? '50%' : '100%',
height: val === 'row' ? 'auto' : '180px',
borderRadius: val === 'row' ? `${radius[3]}px` : '0',
}
})

Expand All @@ -37,6 +36,11 @@ interface CommentsUpsellPanelProps {
layout?: Layout
}

/**
* First 2 viewport sizes are always vertical, 3rd is horizontal
*/
const HORIZONTAL_PADDING_Y = [3, 3, 5]

export function UpsellPanel(props: CommentsUpsellPanelProps) {
const {data, onPrimaryClick, onSecondaryClick, layout = 'vertical'} = props
const direction: FlexDirection[] = [
Expand All @@ -55,7 +59,7 @@ export function UpsellPanel(props: CommentsUpsellPanelProps) {
$direction={direction}
/>
)}
<DescriptionRoot padding={3}>
<DescriptionRoot paddingX={3} paddingY={layout === 'horizontal' ? HORIZONTAL_PADDING_Y : 3}>
<Stack space={4}>
<UpsellDescriptionSerializer blocks={data.descriptionText} />
</Stack>
Expand Down
Loading