mirror of
				https://github.com/CorentinTh/it-tools.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	fix(style): url encode/decode layout
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
				
			|||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <n-space item-style="flex:1">
 | 
					  <div>
 | 
				
			||||||
    <n-card title="Encode">
 | 
					    <n-card title="Encode">
 | 
				
			||||||
      <n-form-item
 | 
					      <n-form-item
 | 
				
			||||||
        label="Your string :"
 | 
					        label="Your string :"
 | 
				
			||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
          v-model:value="encodeInput"
 | 
					          v-model:value="encodeInput"
 | 
				
			||||||
          type="textarea"
 | 
					          type="textarea"
 | 
				
			||||||
          placeholder="The string to encode"
 | 
					          placeholder="The string to encode"
 | 
				
			||||||
          :autosize="{ minRows: 3 }"
 | 
					          :autosize="{ minRows: 2 }"
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
      </n-form-item>
 | 
					      </n-form-item>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -20,7 +20,7 @@
 | 
				
			|||||||
          type="textarea"
 | 
					          type="textarea"
 | 
				
			||||||
          readonly
 | 
					          readonly
 | 
				
			||||||
          placeholder="Your string encoded"
 | 
					          placeholder="Your string encoded"
 | 
				
			||||||
          :autosize="{ minRows: 3 }"
 | 
					          :autosize="{ minRows: 2 }"
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
      </n-form-item>
 | 
					      </n-form-item>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -33,9 +33,10 @@
 | 
				
			|||||||
        </n-button>
 | 
					        </n-button>
 | 
				
			||||||
      </n-space>
 | 
					      </n-space>
 | 
				
			||||||
    </n-card>
 | 
					    </n-card>
 | 
				
			||||||
    <n-card title="Encode">
 | 
					    <br>
 | 
				
			||||||
 | 
					    <n-card title="Decode">
 | 
				
			||||||
      <n-form-item
 | 
					      <n-form-item
 | 
				
			||||||
        label="Your encode string :"
 | 
					        label="Your encoded string :"
 | 
				
			||||||
        :feedback="decodeValidation.message"
 | 
					        :feedback="decodeValidation.message"
 | 
				
			||||||
        :validation-status="decodeValidation.status"
 | 
					        :validation-status="decodeValidation.status"
 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
@@ -43,17 +44,17 @@
 | 
				
			|||||||
          v-model:value="decodeInput"
 | 
					          v-model:value="decodeInput"
 | 
				
			||||||
          type="textarea"
 | 
					          type="textarea"
 | 
				
			||||||
          placeholder="The string to decode"
 | 
					          placeholder="The string to decode"
 | 
				
			||||||
          :autosize="{ minRows: 3 }"
 | 
					          :autosize="{ minRows: 2 }"
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
      </n-form-item>
 | 
					      </n-form-item>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      <n-form-item label="Your string decoded :">
 | 
					      <n-form-item label="Your string decoded :"> 
 | 
				
			||||||
        <n-input
 | 
					        <n-input
 | 
				
			||||||
          :value="decodeOutput"
 | 
					          :value="decodeOutput"
 | 
				
			||||||
          type="textarea"
 | 
					          type="textarea"
 | 
				
			||||||
          readonly
 | 
					          readonly
 | 
				
			||||||
          placeholder="Your string decoded"
 | 
					          placeholder="Your string decoded"
 | 
				
			||||||
          :autosize="{ minRows: 3 }"
 | 
					          :autosize="{ minRows: 2 }"
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
      </n-form-item>
 | 
					      </n-form-item>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -66,7 +67,7 @@
 | 
				
			|||||||
        </n-button>
 | 
					        </n-button>
 | 
				
			||||||
      </n-space>
 | 
					      </n-space>
 | 
				
			||||||
    </n-card>
 | 
					    </n-card>
 | 
				
			||||||
  </n-space>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
@@ -76,25 +77,25 @@ import { computed, ref } from 'vue'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const encodeInput = ref('Hello world :)')
 | 
					const encodeInput = ref('Hello world :)')
 | 
				
			||||||
const encodeOutput = computed(() => {
 | 
					const encodeOutput = computed(() => {
 | 
				
			||||||
    try {
 | 
					  try {
 | 
				
			||||||
        return encodeURIComponent(encodeInput.value)
 | 
					    return encodeURIComponent(encodeInput.value)
 | 
				
			||||||
    } catch (_) {
 | 
					  } catch (_) {
 | 
				
			||||||
        return ''
 | 
					    return ''
 | 
				
			||||||
    }
 | 
					  }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const encodedValidation = useValidation({
 | 
					const encodedValidation = useValidation({
 | 
				
			||||||
    source: encodeInput, rules: [{
 | 
					  source: encodeInput, rules: [{
 | 
				
			||||||
        validator: (value) => {
 | 
					    validator: (value) => {
 | 
				
			||||||
            try {
 | 
					      try {
 | 
				
			||||||
                encodeURIComponent(value)
 | 
					        encodeURIComponent(value)
 | 
				
			||||||
                return true
 | 
					        return true
 | 
				
			||||||
            } catch (_) {
 | 
					      } catch (_) {
 | 
				
			||||||
                return false
 | 
					        return false
 | 
				
			||||||
            }
 | 
					      }
 | 
				
			||||||
        },
 | 
					    },
 | 
				
			||||||
        message: 'Impossible to parse this string'
 | 
					    message: 'Impossible to parse this string'
 | 
				
			||||||
    }]
 | 
					  }]
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { copy: copyEncoded } = useCopy({ source: encodeOutput, text: 'Encoded string copied to the clipboard' })
 | 
					const { copy: copyEncoded } = useCopy({ source: encodeOutput, text: 'Encoded string copied to the clipboard' })
 | 
				
			||||||
@@ -103,25 +104,25 @@ const { copy: copyEncoded } = useCopy({ source: encodeOutput, text: 'Encoded str
 | 
				
			|||||||
const decodeInput = ref('Hello%20world%20%3A)')
 | 
					const decodeInput = ref('Hello%20world%20%3A)')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const decodeOutput = computed(() => {
 | 
					const decodeOutput = computed(() => {
 | 
				
			||||||
    try {
 | 
					  try {
 | 
				
			||||||
        return decodeURIComponent(decodeInput.value)
 | 
					    return decodeURIComponent(decodeInput.value)
 | 
				
			||||||
    } catch (_) {
 | 
					  } catch (_) {
 | 
				
			||||||
        return ''
 | 
					    return ''
 | 
				
			||||||
    }
 | 
					  }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const decodeValidation = useValidation({
 | 
					const decodeValidation = useValidation({
 | 
				
			||||||
    source: encodeInput, rules: [{
 | 
					  source: encodeInput, rules: [{
 | 
				
			||||||
        validator: (value) => {
 | 
					    validator: (value) => {
 | 
				
			||||||
            try {
 | 
					      try {
 | 
				
			||||||
                decodeURIComponent(value)
 | 
					        decodeURIComponent(value)
 | 
				
			||||||
                return true
 | 
					        return true
 | 
				
			||||||
            } catch (_) {
 | 
					      } catch (_) {
 | 
				
			||||||
                return false
 | 
					        return false
 | 
				
			||||||
            }
 | 
					      }
 | 
				
			||||||
        },
 | 
					    },
 | 
				
			||||||
        message: 'Impossible to parse this string'
 | 
					    message: 'Impossible to parse this string'
 | 
				
			||||||
    }]
 | 
					  }]
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { copy: copyDecoded } = useCopy({ source: decodeOutput, text: 'Decoded string copied to the clipboard' })
 | 
					const { copy: copyDecoded } = useCopy({ source: decodeOutput, text: 'Decoded string copied to the clipboard' })
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user