Skip to content

Commit

Permalink
added radio and large modal
Browse files Browse the repository at this point in the history
  • Loading branch information
egauzens committed Nov 16, 2023
1 parent e057d16 commit 64f7426
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sparc-design-system-components-2",
"version": "0.0.10",
"version": "0.0.11",
"private": false,
"scripts": {
"dev": "vite",
Expand Down
94 changes: 92 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,77 @@
</el-button>
</template>
</el-dialog>
<large-modal
:visible="dialogVisibleLarge"
@close-download-dialog="dialogVisibleLarge = false"
>
<template class="content" #optionalContent>
<h1>Direct download</h1>
<div>
<p>You can download the raw files and metadata directly to your computer as a zip archive free of charge.</p>
<p class="download-container__download-dataset-size">
Dataset Size: 17.43 GB
</p>
<el-button class="download-button">Download</el-button>
</div>
</template>
<template class="content" #mainContent>
<h1>Download from AWS</h1>
<p>
Raw files and metadata are stored in an AWS S3 Requester Pays bucket.
You can learn more about downloading data from AWS on our
<a href="/#" target="_blank">Help Page</a>.
</p>
<div>
<p>*Requester pays means that any costs associated with downloading the data will be charged to your AWS account.
For transfer pricing information, visit the <a href="https://aws.amazon.com/s3/pricing/" target="blank">AWS Pricing documentation.</a>
</p>
<div>
<el-button class="secondary" @click="dialogVisibleLarge = false">
Close
</el-button>
</div>
</div>
</template>
</large-modal>
<el-button
plain
@click="dialogVisibleLarge = true">
Open Large Modal
</el-button>
<div>
<sparc-radio
v-model="radioVal"
label="1"
:disabled="false"
display="Option 1"
/>
<sparc-radio
v-model="radioVal"
label="2"
:disabled="false"
display="Option 2"
/>
</div>
<div>
<sparc-radio
v-for="r in radios"
v-bind:key="r.label"
v-model="radioVal2"
:label="r.label"
:disabled="r.disabled"
:display="r.display"
/>
</div>
</main>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import SparcTooltip from './components/SparcTooltip.vue'
import SparcLogo from './components/SparcLogo.vue'
import LargeModal from './components/LargeModal.vue'
import SparcRadio from './components/SparcRadio.vue'
import { ref } from 'vue'
import { successMessage, infoMessage, failMessage, informationNotification, iconInformationNotification } from "../utils/notificationMessages"
Expand Down Expand Up @@ -350,7 +414,9 @@
components: {
HelloWorld,
SparcTooltip,
SparcLogo
SparcLogo,
LargeModal,
SparcRadio
},
name: 'App',
setup() {
Expand All @@ -368,12 +434,36 @@
'right-center',
'right-bottom'
])
const radioVal=ref("1");
const radioVal2 = ref(5);
const radios = ref([
{
label: 4,
display: "Option 1",
disabled: false
},
{
label: 5,
display: "Option 2",
disabled: false
},
{
label: 6,
display: "Option 3",
disabled: true
}
])
const dialogVisible = ref(false)
const dialogVisibleLarge = ref(false)
return {
dialogVisible,
dialogVisibleLarge,
tableData,
tooltipDirs
tooltipDirs,
radioVal,
radioVal2,
radios
}
},
methods: {
Expand Down
119 changes: 119 additions & 0 deletions src/components/LargeModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<template>
<el-dialog
:modelValue="visible"
:show-close="true"
class="sparc-design-system-large-modal-dialog"
@close="closeDialog"
>
<div class="dialog-container">
<div class="optional-content-container">
<slot name="optionalContent" />
</div>
<div class="main-content-container">
<slot name="mainContent" />
</div>
</div>
<el-button class="primary">Test</el-button>
</el-dialog>
</template>

<script>
export default {
name: 'LargeModal',
props: {
visible: {
type: Boolean,
default: false
}
},
setup(props, { emit }) {
function closeDialog() {
emit('close-download-dialog');
}
return {
closeDialog,
};
}
};
</script>

<style lang="scss">
@import '../assets/_variables.scss';
.sparc-design-system-large-modal-dialog {
border-radius: 0;
width: fit-content;
max-width: 868px;
button:hover {
box-shadow: none;
}
.optional-content-container {
.download-button {
padding-top: 10px;
padding-bottom: 10px;
background: white !important;
text-align: center;
color: $purple !important;
min-width: 80px;
}
button:hover {
background: white;
color: $purple;
}
}
.el-dialog__body {
padding: 0;
color: black;
}
.el-dialog__header {
padding: 0 !important;
}
}
</style>

<style lang="scss" scoped>
@import '../assets/_variables.scss';
.sparc-design-system-large-modal-dialog {
.dialog-container {
display: flex;
word-break: normal;
}
.main-content-container {
border: 1px solid $lineColor1;
border-left: none;
width: 100%;
padding: 2rem;
}
.optional-content-container {
background-color: $purple;
box-sizing: border-box;
flex-shrink: 0;
color: #fff;
max-width: 316px;
min-width: min-content;
width: 35%;
overflow: hidden;
position: relative;
padding: 2rem;
}
.optional-content-container:empty {
display: none;
}
.close-dialog {
background: none;
border: none;
cursor: pointer;
padding: .25rem .25rem 0 0;
position: absolute;
right: 0;
}
}
</style>
3 changes: 0 additions & 3 deletions src/components/SparcLogo.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<template>
<img class="logo" :src="logoSrc" alt="Logo for SPARC">
<help-icon height="32" fill="red"/>
<el-button>Testing 1</el-button>
<el-button class="secondary">Testing 2</el-button>
</template>

<script>
Expand Down
79 changes: 79 additions & 0 deletions src/components/SparcRadio.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<el-radio
:label="label"
:disabled="disabled"
:modelValue="current"
>
{{ display }}
</el-radio>
</template>

<script>
export default {
name: 'SparcRadio',
props: {
value: {
type: [String, Number, Boolean],
required: true
},
label: {
type: [String, Number, Boolean],
required: true
},
disabled: {
type: Boolean,
default: false
},
display: {
type: [String, Number],
required: true
}
},
computed: {
current: {
get: function() {
return this.value
},
set: function(val) {
this.$emit('input', val)
}
}
}
}
</script>

<style lang="scss" scoped>
@import '../assets/_variables.scss';
:deep(.el-radio__label) {
color: $grey;
}
:deep(.el-radio__input) {
&.is-disabled {
&.is-checked {
.el-radio__inner {
background-color: #909399;
&::after {
background-color: white;
opacity: 80%;
}
}
}
}
&:not(.is-checked) {
.el-radio__inner {
border-color: $lightGrey;
}
}
}
.el-radio {
margin-left: 0;
padding-top: 5px;
&:first-child {
padding-top: 0;
}
}
</style>
6 changes: 6 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import '../assets/styles.scss';

import SparcLogo from './SparcLogo.vue';
import LargeModal from './LargeModal.vue'
import SparcTooltip from './SparcTooltip.vue'
import SparcRadio from './SparcRadio.vue';

export default {
install(app) {
app.component('SparcLogo', SparcLogo);
app.component('LargeModal', LargeModal);
app.component('SparcTooltip', SparcTooltip);
app.component('SparcRadio', SparcRadio);
},
};

0 comments on commit 64f7426

Please sign in to comment.