-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat #128: first step towards responsive layout
- Loading branch information
1 parent
e7bef0c
commit 6f470c5
Showing
12 changed files
with
282 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,3 +88,6 @@ | |
.icon-repeat:before { | ||
content: '\e914'; | ||
} | ||
.icon-menu:before { | ||
content: '\e916'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
body { | ||
background: var(--gray-200); | ||
margin: 0; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<script setup lang="ts"> | ||
import type { FormLanguage, RootNode } from '@getodk/xforms-engine'; | ||
import PrimeButton from 'primevue/button'; | ||
import PrimeDialog from 'primevue/dialog'; | ||
import PrimeRadioButton from 'primevue/radiobutton'; | ||
import { ref } from 'vue'; | ||
const props = defineProps<{ form: RootNode, state: boolean }>(); | ||
const emit = defineEmits(['update:state']); | ||
const languages = props.form.languages.filter(language => !language.isSyntheticDefault); | ||
const selectedLanguage = ref<FormLanguage>(); | ||
const initSelectedLanguage = () => { | ||
if(!props.form.currentState.activeLanguage.isSyntheticDefault) { | ||
selectedLanguage.value = props.form.currentState.activeLanguage; | ||
} | ||
} | ||
initSelectedLanguage(); | ||
const handleSave = () => { | ||
if(!selectedLanguage.value?.isSyntheticDefault){ | ||
props.form.setLanguage(selectedLanguage.value!); | ||
} | ||
emit('update:state',false); | ||
}; | ||
const handleCancel = () => { | ||
initSelectedLanguage(); | ||
emit('update:state',false); | ||
} | ||
</script> | ||
|
||
<template> | ||
<PrimeDialog :visible="state" modal header="Change language" class="language-dialog" :closable="false" @update:visible="handleCancel()"> | ||
<label | ||
v-for="lang in languages" | ||
:key="lang.language" | ||
:for="lang.language" | ||
class="lang-options" | ||
> | ||
<PrimeRadioButton | ||
v-model="selectedLanguage" | ||
:input-id="lang.language" | ||
:name="lang.language" | ||
:value="lang" | ||
/> | ||
{{ lang.language }}</label> | ||
|
||
<div class="flex justify-content-end mt-5"> | ||
<PrimeButton label="Cancel" rounded text @click="handleCancel()" /> | ||
<PrimeButton label="Save" rounded raised @click="handleSave()" /> | ||
</div> | ||
</PrimeDialog> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.lang-options { | ||
width: 100%; | ||
display: block; | ||
border: 1px solid #E6E1E5; | ||
padding: 10px 0 10px 8px; | ||
border-radius: 10px; | ||
margin-bottom: 10px; | ||
cursor: pointer; | ||
&:hover { | ||
border-color: var(--primary-500); | ||
} | ||
} | ||
</style> | ||
|
||
<style lang="scss"> | ||
.p-dialog.language-dialog { | ||
--radius: 20px; | ||
min-width: 300px; | ||
border-radius: var(--radius); | ||
.p-dialog-header { | ||
border-top-right-radius: var(--radius); | ||
border-top-left-radius: var(--radius); | ||
} | ||
.p-dialog-content:last-of-type { | ||
border-bottom-right-radius: var(--radius); | ||
border-bottom-left-radius: var(--radius); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.