Skip to content

Commit

Permalink
fix device examples (en); add yaml highlighting (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis committed Aug 28, 2024
1 parent 009f392 commit 6bca505
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,8 @@ vehicles:
# ...
limitsoc: # optional in-vehicle limit soc, read-only (%)
source: # plugin type
# ...```
# ...
```

### evNotify

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ vehicles:
# ...
limitsoc: # optional in-vehicle limit soc, read-only (%)
source: # plugin type
# ...```
# ...
```
15 changes: 9 additions & 6 deletions src/components/DeviceConfig.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from "react";
import s from "./DeviceConfig.module.css";
import CodeBlock from "@theme/CodeBlock";

const ShowHideCode = ({ code, advanced }) => {
const [showAdvanced, setShowAdvanced] = useState(false);
Expand All @@ -9,10 +10,12 @@ const ShowHideCode = ({ code, advanced }) => {
};

return (
<div>
<pre>
<code>{showAdvanced ? advanced : code}</code>
{advanced ? (
<div className={s.root}>
<CodeBlock className="language-yaml">
{showAdvanced ? advanced : code}
</CodeBlock>
{advanced ? (
<div className={s.advanced}>
<button
onClick={toggleShowAdvanced}
className={s.advancedButton}
Expand All @@ -22,8 +25,8 @@ const ShowHideCode = ({ code, advanced }) => {
{showAdvanced ? "hide advanced options" : "show advanced options"}
</u>
</button>
) : null}
</pre>
</div>
) : null}
</div>
);
};
Expand Down
9 changes: 7 additions & 2 deletions src/components/DeviceConfig.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
background: none;
padding: 0;
cursor: pointer;
color: var(--ifm-color-content-secondary);
}

.advancedButton u {
text-decoration: underline;
}

.advancedButton::before {
content: " ";
.root {
margin-bottom: var(--ifm-leading);
}

.advanced {
padding: 0 var(--ifm-pre-padding);
}

0 comments on commit 6bca505

Please sign in to comment.