Skip to content

Commit 942d385

Browse files
authored
chore: move Badge to components package (#7050)
1 parent 1bd37e5 commit 942d385

File tree

13 files changed

+48
-28
lines changed

13 files changed

+48
-28
lines changed

.codesandbox/tasks.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
"port": 8000,
2828
"prLink": "redirect"
2929
}
30+
},
31+
"storybook": {
32+
"name": "Run storybook",
33+
"command": "cd packages/components && yarn start:storybook"
3034
}
3135
},
3236
"setupTasks": [

packages/app/src/app/components/CloudBetaBadge.tsx

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/app/src/app/components/CreateSandbox/CreateSandbox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
2+
Badge,
23
Text,
34
Stack,
45
Element,
56
IconButton,
67
SkeletonText,
78
ThemeProvider,
89
} from '@codesandbox/components';
9-
import { CloudBetaBadge } from 'app/components/CloudBetaBadge';
1010
import { useActions, useAppState } from 'app/overmind';
1111
import React, { ReactNode, useState, useEffect } from 'react';
1212
import { TabStateReturn, useTabState } from 'reakit/Tab';
@@ -333,7 +333,7 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
333333
>
334334
<Stack gap={2}>
335335
<span>Cloud templates</span>
336-
<CloudBetaBadge hideIcon />
336+
<Badge>Beta</Badge>
337337
</Stack>
338338
</Tab>
339339

packages/app/src/app/components/CreateSandbox/FromTemplate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useAppState } from 'app/overmind';
2-
import { CloudBetaBadge } from 'app/components/CloudBetaBadge';
32
import React, { useState } from 'react';
43
import {
4+
Badge,
55
Stack,
66
Element,
77
Checkbox,
@@ -53,7 +53,7 @@ export const FromTemplate: React.FC<FromTemplateProps> = ({
5353
>
5454
New from template
5555
</Text>
56-
{isV2 && <CloudBetaBadge />}
56+
{isV2 && <Badge icon="cloud">Beta</Badge>}
5757
</Stack>
5858

5959
<Element

packages/app/src/app/components/CreateSandbox/Import/FromRepo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useAppState } from 'app/overmind';
22
import React, { useEffect } from 'react';
33
import {
4+
Badge,
45
Button,
56
Element,
67
Icon,
@@ -12,7 +13,6 @@ import {
1213
} from '@codesandbox/components';
1314
import styled, { keyframes } from 'styled-components';
1415
import track from '@codesandbox/common/lib/utils/analytics';
15-
import { CloudBetaBadge } from 'app/components/CloudBetaBadge';
1616
import { GithubRepoToImport } from './types';
1717
import { StyledSelect } from '../elements';
1818
import { useGithubOrganizations } from './useGithubOrganizations';
@@ -120,7 +120,7 @@ export const FromRepo: React.FC<FromRepoProps> = ({ repository, onCancel }) => {
120120
>
121121
Create new fork
122122
</Text>
123-
<CloudBetaBadge />
123+
<Badge icon="cloud">Beta</Badge>
124124
</Stack>
125125
<Element
126126
as="form"

packages/app/src/app/components/CreateSandbox/TemplateCard.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
2-
import { Stack, Text } from '@codesandbox/components';
2+
import { Badge, Stack, Text } from '@codesandbox/components';
33
import { getTemplateIcon } from '@codesandbox/common/lib/utils/getTemplateIcon';
4-
import { CloudBetaBadge } from 'app/components/CloudBetaBadge';
54
import { TemplateFragment } from 'app/graphql/types';
65
import { VisuallyHidden } from 'reakit/VisuallyHidden';
76
import { TemplateButton } from './elements';
@@ -53,7 +52,7 @@ export const TemplateCard = ({
5352
css={{ justifyContent: 'space-between', alignItems: 'flex-start' }}
5453
>
5554
<UserIcon />
56-
{isV2 && <CloudBetaBadge />}
55+
{isV2 && <Badge icon="cloud">Beta</Badge>}
5756
</Stack>
5857
<Stack direction="vertical" gap={1}>
5958
<Text

packages/app/src/app/components/WorkspaceSelect/WorkspaceSelect.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import React from 'react';
22
import { useActions, useAppState } from 'app/overmind';
3-
import { Text, Menu, Stack, Icon, Tooltip } from '@codesandbox/components';
3+
import {
4+
Badge,
5+
Text,
6+
Menu,
7+
Stack,
8+
Icon,
9+
Tooltip,
10+
} from '@codesandbox/components';
411
import { sortBy } from 'lodash-es';
512
import { TeamAvatar } from 'app/components/TeamAvatar';
6-
import { Badge } from 'app/components/Badge';
713

814
interface WorkspaceSelectProps {
915
disabled?: boolean;

packages/app/src/app/pages/Dashboard/Components/Header/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React, { useState } from 'react';
22
import { useLocation } from 'react-router-dom';
33
import { useAppState, useActions } from 'app/overmind';
4-
import { Stack, Text, Button, Icon } from '@codesandbox/components';
4+
import { Stack, Text, Button, Icon, Badge } from '@codesandbox/components';
55
import css from '@styled-system/css';
6-
import { CloudBetaBadge } from 'app/components/CloudBetaBadge';
76
import { v2DraftBranchUrl } from '@codesandbox/common/lib/utils/url-generator';
87
import { Breadcrumbs, BreadcrumbProps } from '../Breadcrumbs';
98
import { FilterOptions } from '../Filters/FilterOptions';
@@ -94,7 +93,7 @@ export const Header = ({
9493
albumId={albumId}
9594
/>
9695
)}
97-
{showBetaBadge && <CloudBetaBadge />}
96+
{showBetaBadge && <Badge icon="cloud">Beta</Badge>}
9897
</Stack>
9998
<Stack gap={4} align="center">
10099
{location.pathname.includes('/sandboxes') && (

packages/app/src/app/pages/Dashboard/Components/Sandbox/SandboxCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { RepoFragmentDashboardFragment } from 'app/graphql/types';
33
import {
4+
Badge,
45
Stack,
56
Text,
67
Input,
@@ -11,7 +12,6 @@ import {
1112
} from '@codesandbox/components';
1213
import css from '@styled-system/css';
1314
import { shortDistance } from '@codesandbox/common/lib/utils/short-distance';
14-
import { CloudBetaBadge } from 'app/components/CloudBetaBadge';
1515
import { SandboxItemComponentProps } from './types';
1616

1717
const useImageLoaded = (url: string) => {
@@ -370,7 +370,7 @@ const Thumbnail = ({
370370
)}
371371
</div>
372372
<Stack gap={1} css={{ position: 'absolute', top: 6, right: 6 }}>
373-
{showBetaBadge && <CloudBetaBadge />}
373+
{showBetaBadge && <Badge icon="cloud">Beta</Badge>}
374374
<div
375375
style={{
376376
width: 18,

packages/app/src/app/pages/Sandbox/Editor/Header/WorkspaceName/UpgradeToolTip.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import * as React from 'react';
22

33
import track from '@codesandbox/common/lib/utils/analytics';
44
import { Link as RouterLink } from 'react-router-dom';
5-
import { Text, Link, Stack } from '@codesandbox/components';
5+
import { Text, Link, Stack, Badge } from '@codesandbox/components';
66
import Tooltip, {
77
SingletonTooltip,
88
} from '@codesandbox/common/lib/components/Tooltip';
9-
import { Badge } from 'app/components/Badge';
109

1110
const UpgradeToolTip: React.FC = () => (
1211
<Stack>

0 commit comments

Comments
 (0)