Skip to content

Commit 5e0b79c

Browse files
committed
Extract UnavailableWorkPackage to its own file
1 parent 80b74aa commit 5e0b79c

File tree

3 files changed

+41
-43
lines changed

3 files changed

+41
-43
lines changed

lib/components/OpenProjectWorkPackageBlock.tsx

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import { useWorkPackage } from "../hooks/useWorkPackage";
77
import { useWorkPackageSearch } from "../hooks/useWorkPackageSearch";
88
import type { WorkPackage } from "../openProjectTypes";
99
import { linkToWorkPackage } from "../services/openProjectApi";
10-
import { defaultVariables, useColors} from "../services/colors";
10+
import { useColors} from "../services/colors";
1111
import { getAliases } from "../services/slashMenuAliases";
1212
import { useTranslation } from "react-i18next"; // localize react components
1313
import i18n from "../services/i18n.ts"; // localize other code
1414

1515
import { LinkIcon, SearchIcon } from "@primer/octicons-react";
16-
import { SPACER_S, SPACER_M, SPACER_L, SPACER_XL } from "../services/css_constants";
1716
import { WorkPackageElement } from "../elements/workPackageElement";
17+
import { UnavailableWorkPackageElement } from "../elements/unavailableWorkPackageElement";
1818
import styled from "styled-components";
1919

2020
const Block = styled.div.attrs({
@@ -89,53 +89,18 @@ const DropdownOption = styled.div.attrs({
8989
background-color: ${({ selected }) => selected ? 'var(--highlight-wp-background)' : 'var(--bn-colors-menu-background)'};
9090
border: none;
9191
border-radius: var(--bn-border-radius-small);
92-
margin: ${SPACER_S} 0;
93-
padding: 0 ${SPACER_M};
92+
margin: var(--spacer-s) 0;
93+
padding: 0 var(--spacer-m);
9494
cursor: pointer;
9595
`;
9696

97-
const UnavailableWorkPackage = styled.div.attrs({
98-
className: 'op-bn-work-package-placeholder'
99-
})`
100-
${defaultVariables}
101-
padding: ${SPACER_M} ${SPACER_L};
102-
background-color: var(--highlight-wp-background);
103-
border-radius: var(--bn-border-radius-small);
104-
`;
105-
106-
const UnavailableMessage = styled.div.attrs({
107-
className: 'op-bn-unavailable-message'
108-
})`
109-
color: var(--bn-colors-editor-text) !important;
110-
`
111-
112-
const UnavailableMessageHeader = styled.div.attrs({
113-
className: 'op-bn-unavailable-message--header'
114-
})`
115-
font-weight: 600;
116-
color: var(--bn-colors-editor-text) !important;
117-
`
118-
11997
interface BlockProps {
12098
id: string,
12199
props: {
122100
wpid: string;
123101
};
124102
}
125103

126-
const UnavailableWorkPackageElement = ({ header, message }: {header: string, message: string}) => {
127-
return (
128-
<UnavailableWorkPackage>
129-
<UnavailableMessage>
130-
<UnavailableMessageHeader>
131-
{ header }
132-
</UnavailableMessageHeader>
133-
{ message }
134-
</UnavailableMessage>
135-
</UnavailableWorkPackage>
136-
)
137-
}
138-
139104
const OpenProjectWorkPackageBlockComponent = ({
140105
block,
141106
editor,
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { defaultVariables } from "../services/colors.ts";
2+
import styled from "styled-components";
3+
4+
export const UnavailableWorkPackageElement = ({ header, message }: {header: string, message: string}) => {
5+
return (
6+
<UnavailableWorkPackage>
7+
<UnavailableMessage>
8+
<UnavailableMessageHeader>
9+
{ header }
10+
</UnavailableMessageHeader>
11+
{ message }
12+
</UnavailableMessage>
13+
</UnavailableWorkPackage>
14+
)
15+
}
16+
17+
const UnavailableWorkPackage = styled.div.attrs({
18+
className: 'op-bn-work-package-placeholder'
19+
})`
20+
${defaultVariables}
21+
padding: var(--spacer-m) var(--spacer-l);
22+
background-color: var(--highlight-wp-background);
23+
border-radius: var(--bn-border-radius-small);
24+
`;
25+
26+
const UnavailableMessage = styled.div.attrs({
27+
className: 'op-bn-unavailable-message'
28+
})`
29+
color: var(--bn-colors-editor-text) !important;
30+
`
31+
32+
const UnavailableMessageHeader = styled.div.attrs({
33+
className: 'op-bn-unavailable-message--header'
34+
})`
35+
font-weight: 600;
36+
color: var(--bn-colors-editor-text) !important;
37+
`

lib/services/css_constants.ts

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

0 commit comments

Comments
 (0)