Skip to content

Commit

Permalink
Document neo4j-arc theming customization
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Nov 26, 2023
1 parent 4204920 commit 552ff73
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/modules/ROOT/content-nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
* xref:neo4j-arc/index.adoc[Neo4J Arc]
** xref:neo4j-arc/i18n.adoc[]
** xref:neo4j-arc/themes.adoc[]
** xref:neo4j-arc/graph-modelling.adoc[]
** xref:neo4j-arc/graph-interactions.adoc[]
41 changes: 41 additions & 0 deletions docs/modules/ROOT/pages/neo4j-arc/themes.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
:description: This section describes how styling is implemented in neo4j-arc and how to customize it

[[neo4j-arc-themes]]
= Theming

neo4j-arc has full theming support via
https://qubitpi.github.io/styled-components-website/docs/advanced#theming[styled-component] , which provides a theme to
all neo4j-arc components underneath itself via the context API. In the render tree all styled-components will have
access to the provided theme, even when they are multiple levels deep.

Themes are passed down to a component using the `theme` prop

Create a file named *themes.ts*:

[source,typescript]
----
export const theme = {
frameSidebarBackground: "transparent",
};
----

Load the themes:

[source,typescript]
----
import { ThemeProvider } from "styled-components";
import { theme } from "./themes";
export default function MyGraphComponent(): JSX.Element {
const themeData = theme;
return (
<ThemeProvider theme={themeData}>
<GraphVisualizer
...
/>
</ThemeProvider>
);
}
----
2 changes: 2 additions & 0 deletions src/neo4j-arc/graph-visualization/GraphVisualizer/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const StyledNodeInspectorContainer = styled.div<{
export const StyledNodeInspectorTopMenuChevron = styled.button<{
expanded: boolean
}>`
border: none;
outline: none;
background-color: ${props => props.theme.frameSidebarBackground};
cursor: pointer;
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion src/neo4j-arc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neo4j-devtools-arc",
"version": "0.0.68",
"version": "0.0.69",
"main": "dist/neo4j-arc.js",
"author": "Neo4j Inc.",
"license": "GPL-3.0",
Expand Down

0 comments on commit 552ff73

Please sign in to comment.