|
| 1 | +import React from 'react'; |
| 2 | +import { |
| 3 | + css, |
| 4 | + cx, |
| 5 | + Link, |
| 6 | + palette, |
| 7 | + spacing, |
| 8 | + useDarkMode, |
| 9 | + Body, |
| 10 | +} from '@mongodb-js/compass-components'; |
| 11 | +import { createLoggerAndTelemetry } from '@mongodb-js/compass-logging'; |
| 12 | + |
| 13 | +const { track } = createLoggerAndTelemetry('COMPASS-SCHEMA-UI'); |
| 14 | + |
| 15 | +const iconSize = spacing[5]; |
| 16 | + |
| 17 | +const bannerBodyStyles = css({ |
| 18 | + display: 'flex', |
| 19 | + alignItems: 'center', |
| 20 | + gap: spacing[3], |
| 21 | + paddingTop: spacing[2], |
| 22 | + paddingBottom: spacing[2], |
| 23 | + paddingLeft: spacing[3], |
| 24 | + paddingRight: spacing[3], |
| 25 | + borderRadius: '12px', |
| 26 | + marginLeft: spacing[3], |
| 27 | + marginRight: spacing[3], |
| 28 | + '&:not(:last-child)': { |
| 29 | + marginBottom: spacing[4], |
| 30 | + }, |
| 31 | +}); |
| 32 | + |
| 33 | +const bannerBodyLightModeStyles = css({ |
| 34 | + backgroundColor: palette.gray.light3, |
| 35 | + boxShadow: `inset 0 0 0 1px ${palette.gray.light2}`, |
| 36 | +}); |
| 37 | + |
| 38 | +const bannerBodyDarkModeStyles = css({ |
| 39 | + backgroundColor: palette.gray.dark3, |
| 40 | + boxShadow: `inset 0 0 0 1px ${palette.gray.dark2}`, |
| 41 | +}); |
| 42 | + |
| 43 | +const bannerIconStyles = css({ |
| 44 | + width: iconSize, |
| 45 | + height: iconSize, |
| 46 | + flex: 'none', |
| 47 | +}); |
| 48 | + |
| 49 | +const bannerTextStyles = css({ |
| 50 | + flex: 'none', |
| 51 | +}); |
| 52 | + |
| 53 | +const bannerLinkStyles = css({ |
| 54 | + flex: 'none', |
| 55 | + marginLeft: 'auto', |
| 56 | +}); |
| 57 | + |
| 58 | +export const HackoladePromoBanner: React.FunctionComponent = () => { |
| 59 | + const darkMode = useDarkMode(); |
| 60 | + return ( |
| 61 | + <Body |
| 62 | + as="div" |
| 63 | + className={cx( |
| 64 | + bannerBodyStyles, |
| 65 | + bannerBodyLightModeStyles, |
| 66 | + darkMode && bannerBodyDarkModeStyles |
| 67 | + )} |
| 68 | + > |
| 69 | + <svg |
| 70 | + className={bannerIconStyles} |
| 71 | + xmlns="http://www.w3.org/2000/svg" |
| 72 | + fill="none" |
| 73 | + viewBox={`0 0 ${iconSize} ${iconSize}`} |
| 74 | + > |
| 75 | + <rect width="31" height="31" x=".5" y=".5" fill="#fff" rx="15.5" /> |
| 76 | + <path fill="#189FCE" d="M19.25 8h-9v9l9-9Z" /> |
| 77 | + <path fill="#0073B2" d="M10.25 24v-6.5l5-5h6.5L10.25 24Z" /> |
| 78 | + <path fill="#22386F" d="m16.25 18.5 5.5-5.5v11l-5.5-5.5Z" /> |
| 79 | + <rect width="31" height="31" x=".5" y=".5" stroke="#C1C7C6" rx="15.5" /> |
| 80 | + </svg> |
| 81 | + <Body as="strong" className={bannerTextStyles}> |
| 82 | + Looking for data modelling tools? |
| 83 | + </Body> |
| 84 | + <Link |
| 85 | + className={bannerLinkStyles} |
| 86 | + href="https://hackolade.com/MongoDBcompass.html?utm_source=mongodb&utm_medium=referral&utm_campaign=compass" |
| 87 | + target="_blank" |
| 88 | + onClick={() => { |
| 89 | + track('Hackolade Link Clicked'); |
| 90 | + }} |
| 91 | + > |
| 92 | + Check out Hackolade Studio. |
| 93 | + </Link> |
| 94 | + </Body> |
| 95 | + ); |
| 96 | +}; |
0 commit comments