Skip to content

Commit 9863aa2

Browse files
Add app and org logos
1 parent 1e94d84 commit 9863aa2

4 files changed

Lines changed: 21 additions & 33 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- run: npm ci
4040
env:
4141
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
- run: npm install --no-save @microbit-foundation/python-editor-v3-microbit@0.2.0-multiple.projects.storage.49 @microbit-foundation/website-deploy-aws@0.6.0 @microbit-foundation/website-deploy-aws-config@0.9.0 @microbit-foundation/circleci-npm-package-versioner@1
42+
- run: npm install --no-save @microbit-foundation/python-editor-v3-microbit@0.2.0-multiple.projects.storage.53 @microbit-foundation/website-deploy-aws@0.6.0 @microbit-foundation/website-deploy-aws-config@0.9.0 @microbit-foundation/circleci-npm-package-versioner@1
4343
if: github.repository_owner == 'microbit-foundation'
4444
env:
4545
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

src/deployment/default/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6+
import { Box, BoxProps } from "@chakra-ui/react";
67
import { ReactNode, createContext } from "react";
78
import { CookieConsent, DeploymentConfigFactory } from "..";
89
import { ConsoleLogging } from "./logging";
@@ -16,8 +17,15 @@ const stubConsentContext = createContext<CookieConsent | undefined>(
1617
stubConsentValue
1718
);
1819

20+
const DefaultAppLogo = (props: BoxProps) => (
21+
<Box as="span" fontSize="2xl" fontWeight="normal" whiteSpace="nowrap" {...props}>
22+
Python Editor
23+
</Box>
24+
);
25+
1926
const defaultDeploymentFactory: DeploymentConfigFactory = () => ({
2027
chakraTheme: theme,
28+
AppLogo: DefaultAppLogo,
2129
// This isn't ideal as it's the branded version. You can just remove the field to remove the welcome dialog.
2230
welcomeVideoYouTubeId: "mREwMW69qKc",
2331
logging: new ConsoleLogging(),

src/deployment/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6-
import { ReactNode, useContext } from "react";
6+
import { BoxProps } from "@chakra-ui/react";
7+
import { ComponentType, ReactNode, useContext } from "react";
78
import { Logging } from "../logging/logging";
89

910
export type DeploymentConfigFactory = (
@@ -24,6 +25,10 @@ export interface DeploymentConfig {
2425
welcomeVideoYouTubeId?: string;
2526
squareLogo?: ReactNode;
2627
horizontalLogo?: ReactNode;
28+
/** Product wordmark, e.g. "Python Editor". */
29+
AppLogo?: ComponentType<BoxProps>;
30+
/** Organisation logo, e.g. the micro:bit logo. */
31+
OrgLogo?: ComponentType<BoxProps>;
2732
compliance: {
2833
/**
2934
* A provider that will be used to wrap the app UI.

src/homepage/DefaultPageLayout.tsx

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6-
import { Box, Flex, Heading, HStack, VStack } from "@chakra-ui/react";
6+
import { Box, Flex, HStack, VStack } from "@chakra-ui/react";
77
import { ReactNode } from "react";
88
import { Link as RouterLink } from "react-router-dom";
99
import HomeButton from "../common/HomeButton";
@@ -19,49 +19,24 @@ interface DefaultPageLayoutProps {
1919
}
2020

2121
const Branding = () => {
22-
const brand = useDeployment();
22+
const { AppLogo, OrgLogo } = useDeployment();
2323
return (
2424
<HStack
2525
as={RouterLink}
2626
to={createHomePageUrl()}
2727
spacing="0.875rem"
2828
alignItems="center"
29+
color="white"
2930
borderRadius="md"
3031
_focusVisible={{ boxShadow: "outline", outline: "none" }}
3132
>
32-
{brand.squareLogo && (
33+
{OrgLogo && (
3334
<>
34-
<HStack spacing="0.5rem">
35-
<Box
36-
h="30px"
37-
w="auto"
38-
color="white"
39-
role="img"
40-
display="flex"
41-
alignItems="center"
42-
sx={{ "& svg": { height: "100%", width: "auto" } }}
43-
>
44-
{brand.squareLogo}
45-
</Box>
46-
<Box
47-
h="30px"
48-
w="auto"
49-
color="white"
50-
role="img"
51-
display={{ base: "none", sm: "flex" }}
52-
alignItems="center"
53-
sx={{ "& svg": { height: "100%", width: "auto" } }}
54-
>
55-
{brand.horizontalLogo}
56-
</Box>
57-
</HStack>
35+
<OrgLogo height="30px" />
5836
<Box h="28px" borderLeftWidth="1px" borderColor="whiteAlpha.600" />
5937
</>
6038
)}
61-
{/* Product name; deliberately not translated. */}
62-
<Heading as="h1" fontSize="2xl" fontWeight="normal" color="white">
63-
Python Editor
64-
</Heading>
39+
{AppLogo && <AppLogo h="20px" />}
6540
</HStack>
6641
);
6742
};

0 commit comments

Comments
 (0)