forked from opensumi/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add custom menubar sample for startup (opensumi#525)
- Loading branch information
Showing
7 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions
17
packages/startup/entry/sample-modules/menu-bar/menu-bar.contribution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Injectable } from '@opensumi/di'; | ||
import { ComponentContribution, ComponentRegistry, Domain } from '@opensumi/ide-core-browser'; | ||
import { MenuBarView } from './menu-bar.view'; | ||
|
||
@Injectable() | ||
@Domain(ComponentContribution) | ||
export class MenuBarContribution implements ComponentContribution { | ||
// Component key | ||
static MenuBarContainer = '@opensumi/menu-bar-example'; | ||
|
||
registerComponent(registry: ComponentRegistry): void { | ||
registry.register(MenuBarContribution.MenuBarContainer, { | ||
component: MenuBarView, | ||
id: MenuBarContribution.MenuBarContainer, | ||
}); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/startup/entry/sample-modules/menu-bar/menu-bar.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.menu_bar_view { | ||
display: flex; | ||
background-color: var(--kt-menubar-background); | ||
height: var(--tabBar-height); | ||
align-items: center; | ||
} | ||
.menu_bar_view .menu_bar_logo { | ||
display: inline-block; | ||
height: 24px; | ||
width: 24px; | ||
background-image: url(logo.svg); | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
background-size: contain; | ||
margin-left: 10px; | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/startup/entry/sample-modules/menu-bar/menu-bar.module.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.menu_bar_view { | ||
display: flex; | ||
background-color: var(--kt-menubar-background); | ||
height: var(--tabBar-height); | ||
align-items: center; | ||
|
||
.menu_bar_logo { | ||
display: inline-block; | ||
height: 24px; | ||
width: 24px; | ||
background-image: url(./logo.svg); | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
background-size: contain; | ||
margin-left: 10px; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/startup/entry/sample-modules/menu-bar/menu-bar.view.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from 'react'; | ||
import { MenuBar } from '@opensumi/ide-menu-bar/lib/browser/menu-bar.view'; | ||
|
||
import * as styles from './menu-bar.module.less'; | ||
|
||
/** | ||
* Custom menu bar component. | ||
* Add a logo in here, and keep | ||
* opensumi's original menubar. | ||
*/ | ||
export const MenuBarView = () => ( | ||
<div className={styles.menu_bar_view}> | ||
<span className={styles.menu_bar_logo} /> | ||
<MenuBar /> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters