Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/shared/components/TextInput.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script setup lang="ts">
import { defineProps } from 'vue';

defineProps<{
placeholder: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

placeholder は optional にしてほしい!

size: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size というのは若干直感的ではないかも? (HTML要素の <input> に直接渡してるけど、これは求めているものではなさそう)

雑にやるなら size はなくて良くて、ちゃんとやりたいなら 'sm' | 'md' | 'lg' みたいな感じでやると良さそうに見えます!

}>();
</script>

<template>
<div class="background">
<div v-if="$slots['left']" class="side-icon">
<slot name="left" />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional] <slot> に直接 class を書いた方がスッキリするかも

<input
type="text"
class="text-input"
:size="size"
:placeholder="placeholder"
/>
<div v-if="$slots['right']" class="side-icon">
<slot name="right" />
</div>
</div>
</template>

<style lang="scss" scoped>
.background {
display: inline flex;
height: 32px;
align-items: center;
border-color: $color-border;
border: 1px solid;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

border-color プロパティが border ショートハンドによって上書きされてそう (ref: https://developer.mozilla.org/ja/docs/Web/CSS/border#%E6%A7%8B%E6%88%90%E8%A6%81%E7%B4%A0%E3%81%AE%E3%83%97%E3%83%AD%E3%83%91%E3%83%86%E3%82%A3)

border で一緒に指定してあげると良さそう!

border-radius: 4px;
}
.background:focus-within {
outline: 2px solid;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outline は primary-color とかの方が良い感じかも

}
.text-input {
height: 32px;
padding: 8px 8px;
border: none;
outline: none;
font-size: 16px;
font-weight: 500;
background-color: transparent;
}
.text-input::placeholder {
color: $color-text-placeholder;
opacity: 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opacity: 1 は特に意味のないCSSかも…?

}
.side-icon {
display: flex;
padding: 0 4px;
height: 32px;
align-items: center;
}
</style>
2 changes: 2 additions & 0 deletions src/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $color-secondary: #e2e2e2;
$color-secondary-hover: #f0f0f0;
$color-secondary-disabled: #c9cac9;

$color-border: #414143;
$color-border-hover: #2b2b2b;
$color-error: #ff4500;

Expand All @@ -18,6 +19,7 @@ $color-text-secondary-pale: #5151515d;
$color-text-secondary-disabled: #939393;
$color-text-white: #ffffff;
$color-text-dimmed: #626264;
$color-text-placeholder: #757578;

$color-container-primary: #dcefdd;
$color-container-secondary: #f1f1f4;
Expand Down