mirror of
https://github.com/gitlabhq/gitlabhq.git
synced 2025-08-19 01:23:09 +00:00
36 lines
706 B
Vue
36 lines
706 B
Vue
<script>
|
|
export default {
|
|
name: 'CodeBlock',
|
|
props: {
|
|
code: {
|
|
type: String,
|
|
required: false,
|
|
default: '',
|
|
},
|
|
maxHeight: {
|
|
type: String,
|
|
required: false,
|
|
default: 'initial',
|
|
},
|
|
},
|
|
computed: {
|
|
styleObject() {
|
|
const { maxHeight } = this;
|
|
const isScrollable = maxHeight !== 'initial';
|
|
const scrollableStyles = {
|
|
maxHeight,
|
|
overflowY: 'auto',
|
|
};
|
|
|
|
return isScrollable ? scrollableStyles : null;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<template>
|
|
<pre
|
|
class="code-block rounded code code-syntax-highlight-theme"
|
|
:style="styleObject"
|
|
><slot><code class="gl-block">{{ code }}</code></slot></pre>
|
|
</template>
|