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
3 changes: 2 additions & 1 deletion src/components/pages/Home/HeroSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ 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={githubVideoMp4} mode="bitbucket" />}
/>
</Box>
</Collapser>
Expand Down
248 changes: 219 additions & 29 deletions src/components/pages/Home/UseCasesSection/index.tsx

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/gatsby-plugin-theme-ui/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Switchable from '../components/organisms/SwitchableMode/Switchable'
import Switch from '../components/organisms/SwitchableMode/Switch'
import { ReactComponent as GitHubIcon } from '../media/icons/github.svg'
import { ReactComponent as GitLabIcon } from '../media/icons/gitlab.svg'
import { ReactComponent as BitbucketIcon } from '../media/icons/bitbucket.svg'

const getTextFromPreChildren = preChildren => {
return Array.from(preChildren).reduce((acc, child, index) => {
Expand Down Expand Up @@ -141,6 +142,18 @@ const RepoButton = ({ url, host = new URL(url).host }) => {
<span>GitLab</span>
</Link>
)
case 'bitbucket.org':
return (
<Link
href={url}
target="_blank"
rel="noopener noreferrer"
variant="RepoButton"
>
<BitbucketIcon width="14" height="14" />
casperdcl marked this conversation as resolved.
Show resolved Hide resolved
<span>Bitbucket</span>
</Link>
)
default:
return null
}
Expand Down
16 changes: 11 additions & 5 deletions src/gatsby-plugin-theme-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ export default {
RepoButton: {
casperdcl marked this conversation as resolved.
Show resolved Hide resolved
variant: 'buttons.base',
textAlign: 'center',
width: '96px',
width: '103px',
display: 'flex',
flexFlow: 'row nowrap',
alignItems: 'center',
Expand Down Expand Up @@ -718,13 +718,19 @@ export default {
Left: {
'::before': {
left: '0',
right: '50%'
right: '66%'
}
},
Center: {
'::before': {
left: '33%',
right: '33%'
}
},
Right: {
'::before': {
right: '0',
left: '50%'
left: '66%',
right: '0'
}
},
Label: {
Expand All @@ -748,7 +754,7 @@ export default {
py: 1,
px: 2,
zIndex: '3',
width: '50%',
width: '33%',
textAlign: 'center',
display: 'inline-block',
position: 'relative',
Expand Down
1 change: 1 addition & 0 deletions src/media/icons/bitbucket.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/bitbucket/base-case-report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/bitbucket/cloud-report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/bitbucket/cml-runner-report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/bitbucket/dvc-report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/bitbucket/tensorboard-report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.