Skip to content
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
12 changes: 5 additions & 7 deletions static/app/components/core/alert/alert.chonk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import type {SerializedStyles} from '@emotion/react';
import {css} from '@emotion/react';

import type {AlertProps} from 'sentry/components/core/alert';
import {chonkStyled, type useChonkTheme} from 'sentry/utils/theme/theme';
import type {Theme} from 'sentry/utils/theme';
import {chonkStyled} from 'sentry/utils/theme/theme';
import type {ChonkPropMapping} from 'sentry/utils/theme/withChonk';
import {unreachable} from 'sentry/utils/unreachable';

Expand All @@ -19,7 +20,7 @@ export const chonkAlertPropMapping: ChonkPropMapping<

interface ChonkAlertProps extends Omit<AlertProps, 'type'> {
type: 'subtle' | 'info' | 'warning' | 'success' | 'danger';
theme?: ReturnType<typeof useChonkTheme>;
theme?: Theme;
}

export const AlertPanel = chonkStyled('div')<ChonkAlertProps>`
Expand Down Expand Up @@ -59,10 +60,7 @@ function makeChonkAlertTheme(props: ChonkAlertProps): SerializedStyles {
`;
}

function getChonkAlertTokens(
type: ChonkAlertProps['type'],
theme: ReturnType<typeof useChonkTheme>
) {
function getChonkAlertTokens(type: ChonkAlertProps['type'], theme: Theme) {
switch (type) {
case 'info':
return {
Expand Down Expand Up @@ -104,7 +102,7 @@ function getChonkAlertTokens(
function generateAlertBackground(
props: ChonkAlertProps,
tokens: ReturnType<typeof getChonkAlertTokens>,
theme: ReturnType<typeof useChonkTheme>
theme: Theme
) {
const width = 44;
if (props.showIcon) {
Expand Down
8 changes: 3 additions & 5 deletions static/app/components/core/badge/badge.chonk.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {chonkStyled, type useChonkTheme} from 'sentry/utils/theme/theme';
import type {Theme} from 'sentry/utils/theme';
import {chonkStyled} from 'sentry/utils/theme/theme';
import type {ChonkPropMapping} from 'sentry/utils/theme/withChonk';
import {unreachable} from 'sentry/utils/unreachable';

Expand Down Expand Up @@ -44,10 +45,7 @@ const StyledChonkBadge = chonkStyled('span')<ChonkBadgeProps>`
padding: ${p => p.theme.space.xs} ${p => p.theme.space.xs};
`;

function makeChonkBadgeTheme(
p: ChonkBadgeProps,
theme: ReturnType<typeof useChonkTheme>
): React.CSSProperties {
function makeChonkBadgeTheme(p: ChonkBadgeProps, theme: Theme): React.CSSProperties {
switch (p.type) {
// @TODO(jonasbadalic) these should use feature badge variants
case 'alpha':
Expand Down
5 changes: 1 addition & 4 deletions static/app/utils/theme/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* - Theme type exports
*/
import type {CSSProperties} from 'react';
import {css, useTheme} from '@emotion/react';
import {css} from '@emotion/react';
import styled from '@emotion/styled';
import modifyColor from 'color';
import {spring, type Transition} from 'framer-motion';
Expand Down Expand Up @@ -1696,7 +1696,4 @@ export type StrictCSSObject = {
[key: `> ${string}:first-child`]: StrictCSSObject; // Allow some nested selectors
}>;

// tkdodo: kept for backwards compatibility, to be deleted

export const chonkStyled = styled;
export const useChonkTheme = useTheme;
Loading