appsmithorg / appsmithorg/appsmith

[Enhancement] Improve StyledComponents theme Autocomplete for React Client Code

Đang mở
#6,843 21 bình luận 0 reaction 1 người được giao Được giao cho @mahimathacker Xem trên GitHub
Frontend Good First Issue hacktoberfest Task
Ngôn ngữ chính
TypeScript
Star
40.9k
Fork
4.8k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
45

Mô tả

check the code here - https://github.com/appsmithorg/appsmith/blob/release/app/client/src/constants/DefaultTheme.tsx#L345

## Problem
Currently, for generic type value in theme for example `colors: any`, when we need to add something like
`color: ${props.theme.colors.dropdown.header.text};` using styled-components

We do not get an auto-complete prediction for such cases and also if wrote theme objects value reference incorrectly no error is generated.

## Expected

1. To see predictions when referring to theme objects value :

#### Example
```js
`props.theme.colors.dropdown.hea`
-- header
-- heading
```

2. See error when incorrectly used theme object
#### Example
```js
const theme = {
colors: {
primary: "#FFFFFF"
}
};

// demo component
const Wrapper = styled.div`
color: ${props => props.theme.colors.incorrectPrimary}; // Should show error - no incorrectPrimary is defined
`
```

## Solution
Ideally, we could generate the `Colors` type from the union of theme object's colors value & dark and light theme's color values.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.