Skip to content

Commit 387db50

Browse files
committed
Add blue and orange active color variants to prompt type buttons and update header layout
- active prompt type button should have persistent blue background - 'ask' should be orange when active - `packages/ui/src/components/editor/prompt/PromptTypeButton/PromptTypeButton.tsx` should accept param 'active color': 'blue' | 'orange', use none when not set. - set active color to blue on 'edit' - remove unused css ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ └── frontend │ ├── Home │ │ ├── Home.module.scss │ │ └── Home.tsx │ └── Main │ └── MainView │ └── components │ └── Header │ ├── Header.module.scss │ ├── Header.tsx │ └── index.ts └── packages └── ui └── src ├── components │ └── editor │ ├── common │ │ ├── Button │ │ │ ├── Button.module.scss │ │ │ ├── Button.stories.tsx │ │ │ ├── Button.tsx │ │ │ └── index.ts │ │ ├── Checkbox │ │ │ ├── Checkbox.module.scss │ │ │ ├── Checkbox.stories.tsx │ │ │ ├── Checkbox.tsx │ │ │ └── index.ts │ │ ├── Dropdown │ │ │ ├── Dropdown.module.scss │ │ │ ├── Dropdown.stories.tsx │ │ │ ├── Dropdown.tsx │ │ │ └── index.ts │ │ ├── DropdownMenu │ │ │ ├── DropdownMenu.module.scss │ │ │ ├── DropdownMenu.stories.tsx │ │ │ ├── DropdownMenu.tsx │ │ │ └── index.ts │ │ ├── Field │ │ │ ├── Field.module.scss │ │ │ ├── Field.stories.tsx │ │ │ ├── Field.tsx │ │ │ └── index.ts │ │ ├── Icon │ │ │ ├── Icon.tsx │ │ │ └── index.ts │ │ ├── IconButton │ │ │ ├── IconButton.module.scss │ │ │ ├── IconButton.stories.tsx │ │ │ ├── IconButton.tsx │ │ │ └── index.ts │ │ ├── Input │ │ │ ├── Input.module.scss │ │ │ ├── Input.stories.tsx │ │ │ ├── Input.tsx │ │ │ └── index.ts │ │ ├── QuickPickButton │ │ │ ├── QuickPickButton.module.scss │ │ │ ├── QuickPickButton.tsx │ │ │ └── index.ts │ │ ├── Radio │ │ │ ├── Radio.module.scss │ │ │ ├── Radio.stories.tsx │ │ │ ├── Radio.tsx │ │ │ └── index.ts │ │ ├── Scrollable │ │ │ ├── Scrollable.module.scss │ │ │ ├── Scrollable.tsx │ │ │ └── index.ts │ │ ├── SimpleCheckbox │ │ │ ├── SimpleCheckbox.module.scss │ │ │ ├── SimpleCheckbox.stories.tsx │ │ │ ├── SimpleCheckbox.tsx │ │ │ └── index.ts │ │ ├── TextButton │ │ │ ├── TextButton.module.scss │ │ │ ├── TextButton.stories.tsx │ │ │ ├── TextButton.tsx │ │ │ └── index.ts │ │ ├── Textarea │ │ │ ├── Textarea.module.scss │ │ │ ├── Textarea.stories.tsx │ │ │ ├── Textarea.tsx │ │ │ └── index.ts │ │ ├── Toggler │ │ │ ├── Toggler.module.scss │ │ │ ├── Toggler.tsx │ │ │ └── index.ts │ │ └── prompts │ │ ├── PromptField │ │ │ ├── PromptField.module.scss │ │ │ ├── PromptField.stories.tsx │ │ │ ├── PromptField.tsx │ │ │ ├── components │ │ │ │ ├── Tooltip.module.scss │ │ │ │ ├── Tooltip.tsx │ │ │ │ └── index.ts │ │ │ ├── hooks │ │ │ │ ├── use-drag-drop.ts │ │ │ │ ├── use-dropdown.ts │ │ │ │ ├── use-ghost-text.ts │ │ │ │ ├── use-handlers │ │ │ │ │ ├── handle-copy.ts │ │ │ │ │ ├── handle-cut.ts │ │ │ │ │ ├── handle-input-change.ts │ │ │ │ │ ├── handle-input-click.ts │ │ │ │ │ ├── handle-key-down.ts │ │ │ │ │ ├── handle-paste.ts │ │ │ │ │ ├── handle-submit.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── types.ts │ │ │ │ │ ├── use-handlers.ts │ │ │ │ │ └── utils.ts │ │ │ │ └── use-keyboard-shortcuts.ts │ │ │ └── index.ts │ │ ├── Template │ │ │ ├── Template.module.scss │ │ │ ├── Template.tsx │ │ │ └── index.ts │ │ └── shared │ │ └── symbols │ │ ├── caret.ts │ │ ├── get-highlighted-text.tsx │ │ ├── index.ts │ │ ├── position-mapping.ts │ │ ├── prompt-symbols.module.scss │ │ ├── reconstruct-raw-value.ts │ │ └── use-symbol-deletion.ts │ └── prompt │ └── PromptTypeButton │ ├── PromptTypeButton.module.scss │ ├── PromptTypeButton.stories.tsx │ ├── PromptTypeButton.tsx │ └── index.ts └── styles └── foundation └── _colors.scss
1 parent 742219d commit 387db50

6 files changed

Lines changed: 73 additions & 19 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Home/Home.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const Home: React.FC<Props> = (props) => {
103103
<div className={styles['header__home']}>
104104
<span className="codicon codicon-home" />
105105
</div>
106-
<span className={styles['header__text']}>CWC</span>
106+
<span className={styles['header__text']}>CODE WEB CHAT</span>
107107
</div>
108108
<div className={styles['header__right']}>
109109
<CompactableActionButton

‎apps/editor/src/views/prompt/frontend/Main/MainView/components/Header/Header.module.scss‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
display: flex;
1616
align-items: center;
1717
padding: 4px 0;
18-
19-
&__prompt-types {
20-
display: flex;
21-
align-items: center;
22-
gap: 0;
23-
}
18+
gap: 2px;
2419
}
2520

2621
&__right {
@@ -85,6 +80,7 @@
8580
white-space: nowrap;
8681
overflow: hidden;
8782
max-width: 100%;
83+
padding-right: 1px;
8884
transition:
8985
transform var(--transition-duration-250)
9086
var(--transition-timing-function),

‎apps/editor/src/views/prompt/frontend/Main/MainView/components/Header/Header.tsx‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ export const Header: React.FC<Props> = (props) => {
6868
title={`${t('header.return')} (Esc)`}
6969
/>
7070
{props.mode == MODE.WEB && (
71-
<div className={styles['header__left__prompt-types']}>
71+
<>
7272
<UiPromptTypeButton
7373
label={web_prompt_type_labels['edit-files']}
7474
icon="edit-sparkle"
7575
is_active={props.web_prompt_type == 'edit-files'}
76+
active_color="blue"
7677
is_compact={
7778
props.web_prompt_type == 'edit-files'
7879
? compact_step >= 2
@@ -85,6 +86,7 @@ export const Header: React.FC<Props> = (props) => {
8586
label={web_prompt_type_labels['ask-about-files']}
8687
icon="chat-sparkle"
8788
is_active={props.web_prompt_type == 'ask-about-files'}
89+
active_color="orange"
8890
is_compact={
8991
props.web_prompt_type == 'ask-about-files'
9092
? compact_step >= 2
@@ -95,18 +97,17 @@ export const Header: React.FC<Props> = (props) => {
9597
props.on_web_prompt_type_change('ask-about-files')
9698
}
9799
/>
98-
</div>
100+
</>
99101
)}
100102
{props.mode == MODE.API && (
101-
<div className={styles['header__left__prompt-types']}>
102-
<UiPromptTypeButton
103-
label={api_prompt_type_labels['edit-files']}
104-
icon="edit-sparkle"
105-
is_active={props.api_prompt_type == 'edit-files'}
106-
is_compact={compact_step >= 1}
107-
on_click={() => props.on_api_prompt_type_change('edit-files')}
108-
/>
109-
</div>
103+
<UiPromptTypeButton
104+
label={api_prompt_type_labels['edit-files']}
105+
icon="edit-sparkle"
106+
is_active={props.api_prompt_type == 'edit-files'}
107+
active_color="blue"
108+
is_compact={compact_step >= 1}
109+
on_click={() => props.on_api_prompt_type_change('edit-files')}
110+
/>
110111
)}
111112
</div>
112113

‎packages/ui/src/components/editor/prompt/PromptTypeButton/PromptTypeButton.module.scss‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,37 @@
3636

3737
&--active {
3838
border-color: var(--vscode-focusBorder) !important;
39+
40+
.button__icon,
41+
.button__label {
42+
opacity: 1;
43+
}
44+
45+
&.button--blue {
46+
background-color: var(--cwc-bg-blue);
47+
48+
.button__icon,
49+
.button__label {
50+
color: var(--cwc-text-color-blue);
51+
}
52+
53+
&:hover {
54+
background-color: var(--cwc-bg-blue);
55+
}
56+
}
57+
58+
&.button--orange {
59+
background-color: var(--cwc-bg-orange);
60+
61+
.button__icon,
62+
.button__label {
63+
color: var(--cwc-text-color-orange);
64+
}
65+
66+
&:hover {
67+
background-color: var(--cwc-bg-orange);
68+
}
69+
}
3970
}
4071

4172
&--compact {
@@ -63,6 +94,7 @@
6394
line-height: 1;
6495
letter-spacing: 1px;
6596
padding-top: 2px;
97+
padding-right: 1px;
6698
overflow: hidden;
6799
text-overflow: ellipsis;
68100
}

‎packages/ui/src/components/editor/prompt/PromptTypeButton/PromptTypeButton.stories.tsx‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@ export const Active = () => (
2929
/>
3030
)
3131

32+
export const ActiveBlue = () => (
33+
<PromptTypeButton
34+
label="Active Blue Button"
35+
icon="check"
36+
is_active
37+
active_color="blue"
38+
on_click={() => console.log('Clicked')}
39+
/>
40+
)
41+
42+
export const ActiveOrange = () => (
43+
<PromptTypeButton
44+
label="Active Orange Button"
45+
icon="check"
46+
is_active
47+
active_color="orange"
48+
on_click={() => console.log('Clicked')}
49+
/>
50+
)
51+
3252
export const Compact = () => (
3353
<PromptTypeButton
3454
label="Compact Button"

‎packages/ui/src/components/editor/prompt/PromptTypeButton/PromptTypeButton.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export namespace PromptTypeButton {
88
icon: string
99
is_compact?: boolean
1010
is_active?: boolean
11+
active_color?: 'blue' | 'orange'
1112
keycap_char?: string
1213
on_click?: () => void
1314
}
@@ -18,7 +19,11 @@ export const PromptTypeButton: FC<PromptTypeButton.Props> = (props) => {
1819
<button
1920
className={cn(styles.button, {
2021
[styles['button--active']]: props.is_active,
21-
[styles['button--compact']]: props.is_compact
22+
[styles['button--compact']]: props.is_compact,
23+
[styles['button--blue']]:
24+
props.is_active && props.active_color == 'blue',
25+
[styles['button--orange']]:
26+
props.is_active && props.active_color == 'orange'
2227
})}
2328
onClick={props.on_click}
2429
type="button"

0 commit comments

Comments
 (0)