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

Add getting started example #62

Merged
merged 20 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update header module
  • Loading branch information
jontallboy committed Jun 9, 2024
commit 1e2927d06101abb676966199060268f64df3df44
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
import { ImageField, ModuleFields } from '@hubspot/cms-components/fields';
import { Menu } from '@hubspot/cms-components';
import {
ImageField,
MenuField,
ModuleFields,
} from '@hubspot/cms-components/fields';
import logo from '../../../assets/sprocket.svg';
import headerStyles from '../../../styles/header.module.css';

export function Component({ fieldValues }) {
return <img src={fieldValues.logo} alt="Logo" />;
return (
<header className={headerStyles.wrapper}>
<nav>
<img src={fieldValues.logo.src} alt="Logo" />
<Menu fieldPath={fieldValues.menu} />
</nav>
</header>
);
}

const DEFAULT_MENU_ID = '53522818668';

export const fields = (
<ModuleFields>
<ImageField
name="logo"
label="Logo"
default={{ src: '../../../assets/sprocket.svg' }}
/>
<ImageField name="logo" label="Logo" default={{ src: logo }} />
<MenuField name="menu" label="Menu" default={DEFAULT_MENU_ID} />
</ModuleFields>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.wrapper {
width: 100%;
background-color: transparent;

nav {
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: row;
padding: 15px 25px;
}
}
6 changes: 3 additions & 3 deletions examples/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"yarpm": "^1.2.0"
},
"scripts": {
"start": "cd project/src && yarpm start",
"postinstall": "cd project/src && yarpm install",
"start": "cd getting-started-project/src && yarpm start",
"postinstall": "cd getting-started-project/src && yarpm install",
"lint:js": "eslint . --ext .js,.jsx",
"prettier": "prettier . --check",
"watch:hubl": "hs watch getting-started-theme getting-started-theme",
"upload:hubl": "hs upload getting-started-theme getting-started-theme",
"deploy": "hs project upload project"
"deploy": "hs project upload getting-started-project"
},
"dependencies": {},
"engines": {
Expand Down