-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
日付コンポーネントの実装 #56
Merged
+145
−0
Merged
日付コンポーネントの実装 #56
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,62 @@ | ||
<script lang="ts" setup> | ||
interface Props { | ||
modelValue: string | ||
} | ||
|
||
const props = defineProps<Props>() | ||
const emit = defineEmits<{ | ||
(e: 'update:modelValue', modelValue: string): void | ||
}>() | ||
|
||
const handleInput = (event: Event) => { | ||
emit('update:modelValue', (event.target as HTMLInputElement).value) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div :class="$style.container"> | ||
<input | ||
:class="$style.input" | ||
:data-is-blank="props.modelValue === ''" | ||
type="datetime-local" | ||
:value="props.modelValue" | ||
@input="handleInput" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<style module lang="scss"> | ||
.container { | ||
display: flex; | ||
align-items: center; | ||
padding: 0.5rem; | ||
border: 1px solid $color-secondary; | ||
border-radius: 6px; | ||
&:focus-within { | ||
border-color: $color-primary; | ||
} | ||
} | ||
.input { | ||
flex-grow: 1; | ||
&[data-is-blank='true'] { | ||
color: $color-secondary; | ||
} | ||
&::-webkit-calendar-picker-indicator { | ||
content: ''; | ||
display: inline-block; | ||
width: 24px; | ||
height: 24px; | ||
background-image: url('/icons/calendar-clock.svg'); | ||
} | ||
&:focus::-webkit-calendar-picker-indicator { | ||
background-image: url('/icons/calendar-clock_focus.svg'); | ||
} | ||
} | ||
.icon { | ||
margin-right: 0.25rem; | ||
color: $color-secondary; | ||
.container:focus-within & { | ||
color: $color-primary; | ||
} | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<script lang="ts" setup> | ||
import FormDate from '/@/components/UI/FormDate.vue' | ||
import { Duration } from '/@/lib/apis' | ||
import Required from '/@/components/UI/Required.vue' | ||
|
||
type DateType = 'since' | 'until' | ||
|
||
interface Props { | ||
modelValue: Duration | ||
sinceRequired?: boolean | ||
} | ||
|
||
const props = defineProps<Props>() | ||
const emit = defineEmits<{ | ||
(e: 'update:modelValue', modelValue: Duration): void | ||
}>() | ||
|
||
const handleInput = (value: string, dateType: DateType) => { | ||
const duration: Duration = { | ||
since: dateType === 'since' ? value : props.modelValue.since, | ||
until: dateType === 'until' ? value : props.modelValue.until | ||
} | ||
emit('update:modelValue', duration) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div :class="$style.container"> | ||
<div :class="$style.formDate"> | ||
<div :class="$style.sinceHead"> | ||
<p :class="$style.head">~から</p> | ||
<required v-if="sinceRequired" /> | ||
</div> | ||
<form-date | ||
:model-value="modelValue.since" | ||
@update:model-value="handleInput($event, 'since')" | ||
/> | ||
</div> | ||
<p :class="$style.wave">~</p> | ||
<div :class="$style.formDate"> | ||
<div :class="$style.untilHead"> | ||
<p :class="$style.head">~まで</p> | ||
</div> | ||
<form-date | ||
:model-value="modelValue.until ?? ''" | ||
@update:model-value="handleInput($event, 'until')" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style module lang="scss"> | ||
.container { | ||
display: flex; | ||
align-items: flex-end; | ||
gap: 0.5rem; | ||
} | ||
.sinceHead { | ||
display: flex; | ||
align-items: center; | ||
gap: 0.5rem; | ||
margin-bottom: 0.25rem; | ||
} | ||
.untilHead { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 0.25rem; | ||
} | ||
.wave { | ||
height: 2.75rem; | ||
display: flex; | ||
align-items: center; | ||
} | ||
.head { | ||
font-size: 0.75rem; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,14 @@ | ||
<script lang="ts" setup> | ||
import ContentHeader from '/@/components/Layout/ContentHeader.vue' | ||
import PageInfoPanels from '/@/components/Index/PageInfoPanels.vue' | ||
import PageContainer from '/@/components/Layout/PageContainer.vue' | ||
import FormDuration from '/@/components/UI/FormDuration.vue' | ||
import { ref } from 'vue' | ||
import { Duration } from '/@/lib/apis' | ||
|
||
const value = ref<Duration>({ since: '', until: '' }) | ||
</script> | ||
|
||
<template> | ||
<page-container> | ||
<content-header | ||
icon-name="mdi:apps" | ||
:header-texts="[{ title: 'Top', url: '/' }]" | ||
detail="ポートフォリオの設定を変更します" | ||
:class="$style.header" | ||
/> | ||
<page-info-panels /> | ||
<form-duration v-model="value" /> | ||
</page-container> | ||
</template> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 書き換わっているので、直してください |
||
|
||
<style lang="scss" module> | ||
.header { | ||
margin: 4rem 0 2rem; | ||
} | ||
</style> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
いい感じにデフォルトのアイコンもfocusしたときに色変わったらいいなって思ってます。