Skip to content

Commit

Permalink
feat: add asider component
Browse files Browse the repository at this point in the history
  • Loading branch information
veaba committed Jul 25, 2022
1 parent 49198ea commit 8c813f7
Show file tree
Hide file tree
Showing 11 changed files with 348 additions and 35 deletions.
104 changes: 104 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,110 @@ const config: ConfigItem =
},
// https://github.com/vuejs-translations/docs-zh-cn
'vuejs-translations/docs-zh-cn': {
ignore: [
'yyx990803', 'NataliaTepluhina', 'skirtles-code', 'bencodezen', 'dependabot[bot]',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'danielkellyio', 'tylermercer',
], // if you need ignore some users
// users: [],?? maybe we need this field.
ignoreTotal: 1, // 过滤低于这个 total 的用户
size: 100,
height: 2500, // TODO: maybe automatic
width: 800,
fontSize: 30,
// isRadius: false,
},
// https://github.com/vuejs-translations/docs-zh-cn
'vuejs-translations/veaba': {
ignore: [
'yyx990803', 'NataliaTepluhina', 'skirtles-code', 'bencodezen', 'dependabot[bot]',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'danielkellyio', 'tylermercer',
], // if you need ignore some users
// users: [],?? maybe we need this field.
ignoreTotal: 1, // 过滤低于这个 total 的用户
size: 100,
height: 2500, // TODO: maybe automatic
width: 800,
fontSize: 30,
// isRadius: false,
},

// https://github.com/vuejs-translations/docs-zh-cn
'vuejs-translations/veaba1': {
ignore: [
'yyx990803', 'NataliaTepluhina', 'skirtles-code', 'bencodezen', 'dependabot[bot]',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'danielkellyio', 'tylermercer',
], // if you need ignore some users
// users: [],?? maybe we need this field.
ignoreTotal: 1, // 过滤低于这个 total 的用户
size: 100,
height: 2500, // TODO: maybe automatic
width: 800,
fontSize: 30,
// isRadius: false,
},

// https://github.com/vuejs-translations/docs-zh-cn
'vuejs-translations/veaba2': {
ignore: [
'yyx990803', 'NataliaTepluhina', 'skirtles-code', 'bencodezen', 'dependabot[bot]',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'danielkellyio', 'tylermercer',
], // if you need ignore some users
// users: [],?? maybe we need this field.
ignoreTotal: 1, // 过滤低于这个 total 的用户
size: 100,
height: 2500, // TODO: maybe automatic
width: 800,
fontSize: 30,
// isRadius: false,
},

// https://github.com/vuejs-translations/docs-zh-cn
'vuejs-translations/veaba3': {
ignore: [
'yyx990803', 'NataliaTepluhina', 'skirtles-code', 'bencodezen', 'dependabot[bot]',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'danielkellyio', 'tylermercer',
], // if you need ignore some users
// users: [],?? maybe we need this field.
ignoreTotal: 1, // 过滤低于这个 total 的用户
size: 100,
height: 2500, // TODO: maybe automatic
width: 800,
fontSize: 30,
// isRadius: false,
},

// https://github.com/vuejs-translations/docs-zh-cn
'vuejs-translations/veaba4': {
ignore: [
'yyx990803', 'NataliaTepluhina', 'skirtles-code', 'bencodezen', 'dependabot[bot]',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
'danielkellyio', 'tylermercer',
], // if you need ignore some users
// users: [],?? maybe we need this field.
ignoreTotal: 1, // 过滤低于这个 total 的用户
size: 100,
height: 2500, // TODO: maybe automatic
width: 800,
fontSize: 30,
// isRadius: false,
},

// https://github.com/vuejs-translations/docs-zh-cn
'vuejs-translations/veaba5': {
ignore: [
'yyx990803', 'NataliaTepluhina', 'skirtles-code', 'bencodezen', 'dependabot[bot]',
'LinusBorg', 'KiritaniAyaka', 'Alex-Sokolov', 'sdras', 'marina-mosti', 'CyberAP',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"vite": "^3.0.0",
"vite-svg-loader": "^3.4.0",
"vitest": "^0.18.0",
"vue": "^3.2.37"
"vue": "^3.2.37",
"vue-highlight-code": "^0.1.16"
},
"devDependencies": {
"@types/lodash": "^4.14.182",
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Home from './pages/Home.vue'
</script>

<template>

<Home></Home>
</template>

Expand All @@ -13,4 +12,5 @@ footer {
color: rgba(56 56 56 / 70%);
font-size: 14px;
}
</style>
133 changes: 133 additions & 0 deletions src/components/ASider.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@

<script setup lang='ts'>
import { ref } from 'vue'
import { HighCode } from 'vue-highlight-code'
import 'vue-highlight-code/dist/style.css';
import config from '@/../config'
import { UserConfig } from '@/types'
const configs = ref(config)
/// --el-box-shadow-dark
const activeRepo = ref('vuejs-translations/docs-zh-cn')
const getCssVarName = (type: string) => {
return `--el-box-shadow${type ? '-' : ''}${type}`
}
const onClickCard = (key: string, item: UserConfig) => {
console.log('item>', key, item)
activeRepo.value = key
}
const codeToString = (codeItem: UserConfig) => {
return JSON.stringify(codeItem, null, 2)
}
const load = () => { }
const loadCode = () => {
console.log('load code=>')
}
</script>

<template>
<ElAside class='aside'>

<h2>Select some repositories</h2>
<el-scrollbar>
<el-space direction="vertical">
<div class='aside-body' v-infinite-scroll="load"></div>
<div :class='"sideCard " + (activeRepo === key ? "active" : "")' v-for="(item, key) of config"
@click='onClickCard(key as string, item)'>

<div class='sideTitle'>
<el-link :href="`https://github.com/${key}`" target="_blank">{{ key }}</el-link>
</div>

<div :class='"sideBody "'>
<el-scrollbar>
<HighCode scrollStyleBool borderRadius='0px' :codeValue='codeToString(item)' codeLines width="280px"
:maxHight="`100vh`" :height='activeRepo === key.toString() ? "50vh" : "200px"'>
</HighCode>
</el-scrollbar>
</div>
</div>

</el-space>
</el-scrollbar>

</ElAside>
</template>
<style scoped lang="scss">
.aside {
width: 330px;
height: 100vh;
background: #252526;
// background: #1e1e1e;
padding-left: 10px;
border-radius: 8px;
overflow: hidden;
padding-bottom: 200px;
}
h2 {
color: #449544;
border-bottom: 1px dashed #ddd;
padding-bottom: 5px;
margin-right: 5px;
}
.aside-body {
height: 98%;
width: 98%;
}
.sideCard {
padding: 10px;
border: 1px solid transparent;
}
.active {
border: 1px solid #67C23A !important;
border-radius: 8px;
transition: 0.5s all;
.sideTitle {
color: var(--el-color-primary) !important;
}
}
.sideTitle {
font-weight: bold;
background: #fff;
padding: 2px 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
a {
color: #007acc
}
}
.sideBody {}
</style>

<style lang='scss'>
.code_area {
overflow-y: auto !important;
}
pre {
overflow: initial !important;
}
.code_header {
.cb {
z-index: 1;
}
}
</style>
Loading

0 comments on commit 8c813f7

Please sign in to comment.