File tree Expand file tree Collapse file tree
Main/MainView/components/Header Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .textarea {
2+ border : 1px solid var (--cwc-border-color );
3+ background : var (--vscode-input-background );
4+ color : var (--vscode-input-foreground );
5+ padding : var (--padding-4px ) var (--padding-8px );
6+ border-radius : var (--border-radius-4px );
7+ width : 100% ;
8+ resize : none ;
9+ overflow : hidden ;
10+
11+ & :hover {
12+ border-color : var (--cwc-border-color-hover );
13+ }
14+
15+ & :focus {
16+ outline : none ;
17+ border-color : var (--vscode-focusBorder );
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ import { useState } from 'react'
2+ import { Textarea } from './Textarea'
3+
4+ export default {
5+ component : Textarea
6+ }
7+
8+ export const Primary = ( ) => {
9+ const [ value , set_value ] = useState ( '' )
10+
11+ return (
12+ < Textarea
13+ value = { value }
14+ on_change = { set_value }
15+ placeholder = "Enter text here"
16+ min_rows = { 3 }
17+ />
18+ )
19+ }
20+
21+ export const WithValue = ( ) => {
22+ const [ value , set_value ] = useState (
23+ 'Initial value\nThis is a multiline text area.'
24+ )
25+
26+ return (
27+ < Textarea
28+ value = { value }
29+ on_change = { set_value }
30+ placeholder = "Will be ignored because value is set"
31+ min_rows = { 3 }
32+ />
33+ )
34+ }
Original file line number Diff line number Diff line change 1+ import TextareaAutosize from 'react-textarea-autosize'
2+ import styles from './Textarea.module.scss'
3+
4+ type Props = {
5+ id ?: string
6+ value : string
7+ placeholder ?: string
8+ min_rows ?: number
9+ max_rows ?: number
10+ on_change : ( value : string ) => void
11+ on_key_down ?: ( e : React . KeyboardEvent < HTMLTextAreaElement > ) => void
12+ }
13+
14+ export const Textarea : React . FC < Props > = ( props ) => {
15+ return (
16+ < TextareaAutosize
17+ id = { props . id }
18+ value = { props . value }
19+ onChange = { ( e ) => props . on_change ( e . target . value ) }
20+ onKeyDown = { props . on_key_down }
21+ className = { styles . textarea }
22+ placeholder = { props . placeholder }
23+ minRows = { props . min_rows }
24+ maxRows = { props . max_rows }
25+ />
26+ )
27+ }
Original file line number Diff line number Diff line change 1+ export * from './Textarea'
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export const ChatInitializedModal: React.FC<Props> = (props) => {
4141 />
4242 </ div >
4343 }
44+ on_background_click = { props . on_close }
4445 footer_slot = {
4546 < Button on_click = { props . on_close } is_focused = { true } >
4647 Close
Load diff This file was deleted.
Original file line number Diff line number Diff line change 11import { useState , useCallback } from 'react'
2- import styles from './CommitMessageModal.module.scss'
32import { Button } from '../../Button'
43import { Modal } from '../Modal'
5- import TextareaAutosize from 'react-textarea-autosize '
4+ import { Textarea } from '../../../common/Textarea '
65import { use_commit_timer } from './hooks/use-commit-timer'
76
87type Props = {
@@ -30,12 +29,11 @@ export const CommitMessageModal: React.FC<Props> = (props) => {
3029 < Modal
3130 title = "Commit changes"
3231 content_slot = {
33- < TextareaAutosize
34- className = { styles . textarea }
32+ < Textarea
3533 value = { message }
36- onChange = { ( e ) => set_message ( e . target . value ) }
37- minRows = { 2 }
38- onKeyDown = { ( e ) => {
34+ on_change = { set_message }
35+ min_rows = { 2 }
36+ on_key_down = { ( e ) => {
3937 if ( e . key == 'Enter' && ( e . metaKey || e . ctrlKey ) ) {
4038 e . preventDefault ( )
4139 handle_accept ( )
Original file line number Diff line number Diff line change @@ -8,11 +8,18 @@ type Props = {
88 footer_slot ?: React . ReactNode
99 content_max_height ?: string
1010 use_full_width ?: boolean
11+ on_background_click ?: ( ) => void
1112}
1213
1314export const Modal : React . FC < Props > = ( props ) => {
15+ const handle_background_click = ( e : React . MouseEvent < HTMLDivElement > ) => {
16+ if ( e . target == e . currentTarget ) {
17+ props . on_background_click ?.( )
18+ }
19+ }
20+
1421 return (
15- < div className = { styles . overlay } >
22+ < div className = { styles . overlay } onClick = { handle_background_click } >
1623 < div
1724 className = { cn ( styles . container , {
1825 [ styles [ 'container--full-width' ] ] : props . use_full_width
Original file line number Diff line number Diff line change 5252 width : var (--size );
5353 height : var (--size );
5454 color : var (--vscode-icon-foreground );
55+
56+ > span {
57+ font-size : 15px !important ;
58+ }
5559 }
5660 }
5761}
Original file line number Diff line number Diff line change 6666 & :hover {
6767 background-color : var (--vscode-toolbar-hoverBackground );
6868 }
69+
70+ > span {
71+ font-size : 15px !important ;
72+ }
6973 }
7074 }
7175}
You can’t perform that action at this time.
0 commit comments