-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
ref(project-creation): Polish the SCM alert frequency component #118375
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
Open
jaydgoss
wants to merge
9
commits into
jaygoss/scm-create-project-animation
Choose a base branch
from
jaygoss/vdy-77-scm-alert-frequency-polish
base: jaygoss/scm-create-project-animation
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
79514f3
ref(project-creation): Align SCM alert frequency with updated design
jaydgoss e5bb14e
ref(project-creation): Animate the custom alert form and portal its m…
jaydgoss 70530c2
ref(project-creation): Fix alert card click target, focus, and alignment
jaydgoss 4def1b0
ref(project-creation): Share the reveal animation and refine alert la…
jaydgoss c6c2ec5
ref(project-creation): Use scraps md sizing across the alert frequenc…
jaydgoss e2dc64b
ref(project-creation): Stack custom threshold fields on mobile and fi…
jaydgoss 21fa9d0
test(project-creation): Match renamed alert label in SCM acceptance test
jaydgoss 692505a
ref(project-creation): Use smaller radio and text in alert option cards
jaydgoss b79f0bd
ref(project-creation): Keep the collapsible reveal from clipping content
jaydgoss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 60 additions & 14 deletions
74
static/app/views/onboarding/components/scmAlertOptionCard.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,82 @@ | ||
| import {Grid, Stack} from '@sentry/scraps/layout'; | ||
| import styled from '@emotion/styled'; | ||
|
|
||
| import {Container, Flex, Grid, Stack} from '@sentry/scraps/layout'; | ||
| import {Radio} from '@sentry/scraps/radio'; | ||
| import {Text} from '@sentry/scraps/text'; | ||
|
|
||
| import {ScmCardButton} from 'sentry/views/onboarding/components/scmCardButton'; | ||
| import {ScmCollapsibleReveal} from 'sentry/views/onboarding/components/scmCollapsibleReveal'; | ||
| import {ScmSelectableContainer} from 'sentry/views/onboarding/components/scmSelectableContainer'; | ||
|
|
||
| interface ScmAlertOptionCardProps { | ||
| isSelected: boolean; | ||
| label: string; | ||
| onSelect: () => void; | ||
| children?: React.ReactNode; | ||
| description?: string; | ||
| } | ||
|
|
||
| export function ScmAlertOptionCard({ | ||
| label, | ||
| description, | ||
| isSelected, | ||
| onSelect, | ||
| children, | ||
| }: ScmAlertOptionCardProps) { | ||
| return ( | ||
| <Stack gap="lg"> | ||
| <ScmCardButton role="radio" aria-checked={isSelected} onClick={onSelect}> | ||
| <ScmSelectableContainer isSelected={isSelected} padding="lg"> | ||
| <Grid gap="md" align="center" columns="min-content 1fr"> | ||
| <Radio size="sm" readOnly checked={isSelected} tabIndex={-1} /> | ||
| <Text bold={isSelected} size="md" density="comfortable"> | ||
| {label} | ||
| </Text> | ||
| </Grid> | ||
| </ScmSelectableContainer> | ||
| </ScmCardButton> | ||
| {children} | ||
| </Stack> | ||
| <ScmSelectableContainer isSelected={isSelected}> | ||
| <Stack gap="0"> | ||
| {/* The padding lives on the button (not the card) so the whole header, | ||
| edge to edge, is part of the click target. */} | ||
| <ScmCardButton | ||
| role="radio" | ||
| aria-checked={isSelected} | ||
| onClick={onSelect} | ||
| style={{width: '100%'}} | ||
| > | ||
| <Container padding="lg"> | ||
| <Grid | ||
| columns="min-content 1fr" | ||
| gap="0 md" | ||
| areas={` | ||
| "radio label" | ||
| ". description" | ||
| `} | ||
| > | ||
| <Flex area="radio" align="center"> | ||
| <Radio size="xs" readOnly checked={isSelected} tabIndex={-1} /> | ||
| </Flex> | ||
| <Container area="label"> | ||
| <Text bold size="sm" density="comfortable"> | ||
| {label} | ||
| </Text> | ||
| </Container> | ||
| {description && ( | ||
| <Container area="description"> | ||
| <Text variant="secondary" size="sm" density="comfortable"> | ||
| {description} | ||
| </Text> | ||
| </Container> | ||
| )} | ||
| </Grid> | ||
| </Container> | ||
| </ScmCardButton> | ||
| {/* Selecting the card expands its body; ScmCollapsibleReveal's height | ||
| tween lets cards in scmCreateProject's layout="position" group | ||
| reflow smoothly. */} | ||
| <ScmCollapsibleReveal open={Boolean(children)}> | ||
| <ExpandedBody>{children}</ExpandedBody> | ||
| </ScmCollapsibleReveal> | ||
|
sentry[bot] marked this conversation as resolved.
|
||
| </Stack> | ||
| </ScmSelectableContainer> | ||
| ); | ||
| } | ||
|
|
||
| // The body indents to line up under the label (header button padding + the xs | ||
| // radio's 12px width + grid column gap) and insets its right/bottom to match | ||
| // the header's padding, since the card itself carries none. The top gap comes | ||
| // from the header button's own bottom padding. | ||
| const ExpandedBody = styled('div')` | ||
| padding: 0 ${p => p.theme.space.lg} ${p => p.theme.space.lg}; | ||
| padding-left: calc(${p => p.theme.space.lg} + 12px + ${p => p.theme.space.md}); | ||
| `; | ||
51 changes: 51 additions & 0 deletions
51
static/app/views/onboarding/components/scmCollapsibleReveal.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import {useState} from 'react'; | ||
| import {AnimatePresence, motion} from 'framer-motion'; | ||
|
|
||
| interface ScmCollapsibleRevealProps { | ||
| children: React.ReactNode; | ||
| /** When true the content is shown; toggling tweens height and opacity. */ | ||
| open: boolean; | ||
| /** Forwarded to the animated element, e.g. as an aria-controls target. */ | ||
| id?: string; | ||
| } | ||
|
|
||
| /** | ||
| * Reveals or hides content with a height + fade tween. Shared by | ||
| * ScmCollapsibleSection and ScmAlertOptionCard so their expand/collapse timing | ||
| * stays in sync. Animating height (rather than display) lets sibling cards in a | ||
| * framer-motion layout="position" group reflow via normal document flow. | ||
| * initial={false} renders the open state without animating on mount. | ||
| */ | ||
| export function ScmCollapsibleReveal({open, id, children}: ScmCollapsibleRevealProps) { | ||
| // overflow:hidden is needed while the height tween runs so the content clips | ||
| // cleanly, but kept on it would also clip anything that extends past the | ||
| // settled bounds, e.g. a focus ring at the edge or an open select menu below. | ||
| // Switch to visible once open and settled, back to hidden whenever animating. | ||
| const [overflow, setOverflow] = useState<'hidden' | 'visible'>( | ||
| open ? 'visible' : 'hidden' | ||
| ); | ||
|
sentry[bot] marked this conversation as resolved.
|
||
|
|
||
| return ( | ||
| <AnimatePresence initial={false}> | ||
| {open && ( | ||
| <motion.div | ||
| key="content" | ||
| id={id} | ||
| initial={{height: 0, opacity: 0}} | ||
| animate={{height: 'auto', opacity: 1}} | ||
| exit={{height: 0, opacity: 0}} | ||
| transition={{duration: 0.2, ease: 'easeOut'}} | ||
| onAnimationStart={() => setOverflow('hidden')} | ||
| onAnimationComplete={() => { | ||
| if (open) { | ||
| setOverflow('visible'); | ||
| } | ||
| }} | ||
| style={{overflow, width: '100%'}} | ||
| > | ||
| {children} | ||
| </motion.div> | ||
| )} | ||
| </AnimatePresence> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.