Skip to content

Commit dd2da6b

Browse files
committed
Added support for a notice banner prop in MojsCode
1 parent ed487bb commit dd2da6b

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

docs/.vuepress/components/MojsCode.vue

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/*
2+
A simplified version of MojsInteractive that cant be edited,
3+
but has more flexibility regarding the code.
4+
25
Usage:
36
<MojsCode
47
id="unique_id"
@@ -24,6 +27,7 @@ new mojs.Shape({
2427
<div class="mojs-interactive__code">
2528
<slot></slot>
2629
</div>
30+
<p v-if="notice" class="mojs-interactive__clicknotice">{{this.notice}}</p>
2731
<div :id="this.id" class="mojs-interactive__result" :class="this.className" :style="style">
2832
<div v-if="controller" :id="this.id + '_controller'" class="mojs-interactive__controller"></div>
2933
</div>
@@ -40,6 +44,7 @@ new mojs.Shape({
4044
height: { type: String, default: '300px' },
4145
code: { type: [String, Boolean], default: '' },
4246
className: { type: String, default: '' },
47+
notice: { type: [String, Boolean], default: false }, // to show a "click somewhere to activate animation" text
4348
},
4449
4550
computed: {
@@ -73,18 +78,25 @@ new mojs.Shape({
7378
}
7479
</script>
7580

76-
<style>
81+
<style lang="stylus">
7782
.mojs-interactive__result {
78-
position: relative;
83+
position: relative
7984
}
8085
.mojs-interactive__result {
81-
background: #f1e2d7;
82-
width: 100%;
83-
height: 400px;
84-
position: relative;
85-
overflow: hidden;
86+
background: #f1e2d7
87+
width: 100%
88+
height: 400px
89+
position: relative
90+
overflow: hidden
8691
}
8792
.mojs-interactive__result svg {
8893
overflow: visible
8994
}
95+
.mojs-interactive__clicknotice {
96+
font-size: 0.85em
97+
color: $c-white
98+
background: $c-purple-light
99+
padding: $s-small $s-large
100+
margin: 0
101+
}
90102
</style>

docs/.vuepress/styles/palette.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ $sidebarWidth = 20rem
3737
$sidebarBg = $c-purple
3838
$contentWidth = 740px
3939

40+
// spacing
41+
$s-small = 0.4rem
42+
$s-medium = 0.85rem
43+
$s-large = 1.5rem
44+
4045
// responsive breakpoints
4146
$MQNarrow = 959px
4247
$MQMobile = 719px

0 commit comments

Comments
 (0)