Skip to content

Commit

Permalink
Merge pull request #1034 from glints-dev/feature/next-alert-position
Browse files Browse the repository at this point in the history
@next Alert: expose top and right position props
  • Loading branch information
music1353 authored Jun 14, 2024
2 parents 3438cbd + 9eca37d commit 8f4b810
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/@next/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export type AlertProps = {
/** Duration of alert in miliseconds */
duration?: number;
zIndex?: number;
position?: {
top?: string;
right?: string;
};
onDismissed?: () => void;
};

Expand All @@ -37,6 +41,7 @@ export const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
duration = 4000,
children,
zIndex,
position,
onDismissed,
}: AlertProps,
ref
Expand Down Expand Up @@ -74,6 +79,7 @@ export const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
data-titled={hasTitle}
data-status={status || 'info'}
zIndex={zIndex}
position={position}
>
<div>
<Icon name={iconName} />
Expand Down
12 changes: 9 additions & 3 deletions src/@next/Alert/AlertStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ import * as Breakpoints from '../utilities/breakpoints';
import { Green, Neutral, Blue, Orange, Red } from '../utilities/colors';
import { space12, space8 } from '../utilities/spacing';

export const StyledAlertContainer = styled.div<{ zIndex?: number }>`
export const StyledAlertContainer = styled.div<{
zIndex?: number;
position?: {
top?: string;
right?: string;
};
}>`
position: fixed;
top: 90px;
right: 24px;
top: ${props => (props.position?.top ? props.position.top : '90px')};
right: ${props => (props.position?.right ? props.position.right : '24px')};
display: flex;
padding: ${space12};
gap: ${space8};
Expand Down

0 comments on commit 8f4b810

Please sign in to comment.