Skip to content

Commit

Permalink
Merge pull request #1393 from mermaid-js/mermaid/10.8.0
Browse files Browse the repository at this point in the history
Add block diagram sample
  • Loading branch information
sidharthv96 authored Feb 5, 2024
2 parents 756c8ae + 351d46c commit b5e6fb2
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/lib/components/Preset.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,26 @@
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
y-axis "Revenue (in $)" 4000 --> 11000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]`
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]`,
Block: `block-beta
columns 3
doc>"Document"]:3
space down1<[" "]>(down) space
block:e:3
l["left"]
m("A wide one in the middle")
r["right"]
end
space down2<[" "]>(down) space
db[("DB")]:3
space:3
D space C
db --> D
C --> db
D --> C
style m fill:#d6d,stroke:#333,stroke-width:4px
`
};
type SampleTypes = keyof typeof samples;
Expand All @@ -135,10 +154,10 @@
};
// Adding in this array will add an icon to the preset menu
const newDiagrams: SampleTypes[] = ['Mindmap', 'QuadrantChart', 'XYChart'];
const newDiagrams: SampleTypes[] = ['QuadrantChart', 'XYChart', 'Block'];
const diagramOrder: SampleTypes[] = [
'Sequence',
'Flow',
'Sequence',
'Class',
'State',
'ER',
Expand All @@ -148,15 +167,16 @@
'Pie',
'Mindmap',
'QuadrantChart',
'XYChart'
'XYChart',
'Block'
];
</script>

<Card title="Sample Diagrams" isOpen={false}>
<div class="flex flex-wrap gap-2 p-2">
{#each diagramOrder as sample}
<button
class="btn btn-primary btn-sm w-28 flex-grow normal-case"
class="btn btn-primary btn-sm w-fit min-w-20 flex-grow normal-case"
on:click={() => loadSampleDiagram(sample)}>
{sample}
{#if newDiagrams.includes(sample)}
Expand Down

0 comments on commit b5e6fb2

Please sign in to comment.