Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home: add bitbucket #362

Merged
merged 14 commits into from
Nov 9, 2022
15 changes: 13 additions & 2 deletions src/components/organisms/SwitchableMode/Switch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ const ModeSwitch = ({
variant = 'switches.primary',
left = 'GitLab',
leftMode = 'gitlab',
right = 'GitHub',
rightMode = 'github',
center = 'Github',
centerMode = 'github',
right = 'Bitbucket',
rightMode = 'bitbucket',
0x2b3bfa0 marked this conversation as resolved.
Show resolved Hide resolved
className = '',
sx
}) => {
Expand All @@ -45,11 +47,15 @@ const ModeSwitch = ({
sx={msx({
...sx,
idPrefix,
// TODO: duplicated in cml.dev/src/components/organisms/SwitchableMode/common.js
modes: {
gitlab: {
variant: `switches.Base.Left`
},
github: {
variant: `switches.Base.Center`
},
bitbucket: {
variant: `switches.Base.Right`
}
}
Expand All @@ -58,6 +64,11 @@ const ModeSwitch = ({
<ModeSwitchLabel mode={leftMode} variant={variant} idPrefix={idPrefix}>
{left}
</ModeSwitchLabel>

<ModeSwitchLabel mode={centerMode} variant={variant} idPrefix={idPrefix}>
{center}
</ModeSwitchLabel>

<ModeSwitchLabel mode={rightMode} variant={variant} idPrefix={idPrefix}>
{right}
</ModeSwitchLabel>
Expand Down
14 changes: 13 additions & 1 deletion src/components/organisms/SwitchableMode/Switchable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const invisible = {
'& video': { display: 'none' }
}

const Switchable = ({ github, gitlab, idPrefix = undefined }) => (
const Switchable = ({ github, gitlab, bitbucket, idPrefix = undefined }) => (
<Box>
<Box
sx={msx({
Expand All @@ -47,6 +47,18 @@ const Switchable = ({ github, gitlab, idPrefix = undefined }) => (
>
{github}
</Box>
<Box
sx={msx({
idPrefix,
...invisible,
modes: {
bitbucket: visible
}
})}
aria-label="Bitbucket-specific content"
>
{bitbucket}
</Box>
</Box>
)

Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/SwitchableMode/common.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const defaultModes = ['gitlab', 'github']
export const defaultModes = ['gitlab', 'github', 'bitbucket']
export const defaultIdPrefix = 'site-mode-'
1 change: 1 addition & 0 deletions src/components/organisms/SwitchableMode/styleHelpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: duplicated in cml.dev/src/components/organisms/SwitchableMode/common.js
const defaultPrefix = `site-mode-`

const makeModeId = (mode, prefix = defaultPrefix) => prefix + mode
Expand Down
6 changes: 5 additions & 1 deletion src/components/pages/Home/HeroSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ReactComponent as ReportsIcon } from '@media/icons/reports.svg'

import githubVideoMp4 from '@media/github/landing-video.mp4'
import gitlabVideoMp4 from '@media/gitlab/landing-video.mp4'
import bitbucketVideoMp4 from '@media/bitbucket/landing-video.mp4'

import backgroundImage from '@media/landing-background.png'

Expand Down Expand Up @@ -102,11 +103,14 @@ const HeroSection: React.ForwardRefRenderFunction<HTMLElement> = () => (
</Box>
<Box sx={{ flex: '1', width: '100%' }}>
<Switch
sx={{ mt: 4, mx: 'auto', maxWidth: ['100%', null, '160px'] }}
sx={{ mt: 4, mx: 'auto', maxWidth: ['100%', null, '240px'] }}
DavidGOrtega marked this conversation as resolved.
Show resolved Hide resolved
/>
<Switchable
gitlab={<LandingVideo src={gitlabVideoMp4} mode="gitlab" />}
github={<LandingVideo src={githubVideoMp4} mode="github" />}
bitbucket={
<LandingVideo src={bitbucketVideoMp4} mode="bitbucket" />
}
/>
</Box>
</Collapser>
Expand Down
Loading