-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
feat: redesign labels #31575
feat: redesign labels #31575
Changes from 9 commits
5ae5475
9d7dd6a
269f120
4b811d5
6a46815
3755f16
1223ca5
913c25d
324e636
4f26653
db6b8b5
e960903
05bdba2
f53f183
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ | |
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
* OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
@@ -25,23 +25,96 @@ export default { | |
|
||
export const ThemeColors = () => { | ||
const { colors } = supersetTheme; | ||
return Object.keys(colors).map(collection => ( | ||
|
||
// Define tones to be displayed in columns | ||
const tones = [ | ||
'dark2', | ||
'dark1', | ||
'base', | ||
'light1', | ||
'light2', | ||
'light3', | ||
'light4', | ||
'light5', | ||
]; | ||
const colorTypes = [ | ||
'primary', | ||
'secondary', | ||
'grayscale', | ||
'error', | ||
'warning', | ||
'alert', | ||
'success', | ||
'info', | ||
]; | ||
return ( | ||
<div> | ||
<h2>{collection}</h2> | ||
<table style={{ width: '300px' }}> | ||
{Object.keys(colors[collection]).map(k => { | ||
const hex = colors[collection][k]; | ||
return ( | ||
<tr> | ||
<td>{k}</td> | ||
<td> | ||
<code>{hex}</code> | ||
<h1>Theme Colors</h1> | ||
<table | ||
style={{ borderCollapse: 'collapse', width: '100%', textAlign: 'left' }} | ||
> | ||
<thead> | ||
<tr> | ||
<th style={{ border: '1px solid #ddd', padding: '8px' }}> | ||
Category | ||
</th> | ||
{tones.map(tone => ( | ||
<th | ||
key={tone} | ||
style={{ border: '1px solid #ddd', padding: '8px' }} | ||
> | ||
{tone} | ||
</th> | ||
))} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{colorTypes.map(category => ( | ||
<tr key={category}> | ||
<td style={{ border: '1px solid #ddd', padding: '8px' }}> | ||
<strong>{category}</strong> | ||
</td> | ||
<td style={{ width: '150px', backgroundColor: hex }} /> | ||
{tones.map(tone => { | ||
const color = colors[category][tone]; | ||
return ( | ||
<td | ||
key={tone} | ||
style={{ | ||
border: '1px solid #ddd', | ||
padding: '8px', | ||
backgroundColor: color || '#fff', | ||
}} | ||
> | ||
{color ? <code>{color}</code> : '-'} | ||
</td> | ||
); | ||
})} | ||
</tr> | ||
); | ||
})} | ||
))} | ||
</tbody> | ||
</table> | ||
<h3> | ||
text.label: <code>{colors.text.label}</code> | ||
</h3> | ||
<div style={{ color: `#${colors.text.label}` }}> | ||
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. Invalid Color Format in Text Label StylingTell me moreWhat is the issue?The code incorrectly prepends '#' to the color value from colors.text.label, which likely already includes the '#' prefix, resulting in an invalid color format. Why this mattersThis will cause the text to be rendered with an invalid color value, making it invisible or using the browser's default color instead of the intended theme color. Suggested changeRemove the '#' prefix: style={{ color: colors.text.label }} Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews. |
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</div> | ||
<h3> | ||
text.help: <code>{colors.text.help}</code> | ||
</h3> | ||
<div style={{ color: `#${colors.text.help}` }}> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. | ||
</div> | ||
<h3>The supersetTheme object</h3> | ||
<code> | ||
<pre>{JSON.stringify(supersetTheme, null, 2)}</pre> | ||
</code> | ||
</div> | ||
)); | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,10 @@ const AntdIconComponent = ({ | |
|
||
export const StyledIcon = styled(AntdIconComponent)<IconType>` | ||
${({ iconColor }) => iconColor && `color: ${iconColor};`}; | ||
span { | ||
// Hack to fix issues with some icons | ||
line-height: 0px !important; | ||
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. Brittle icon fix using CSS hackTell me moreWhat is the issue?Using !important and a hack to fix icon issues could lead to unintended side effects with different icon sets or future updates. Why this mattersThis brittle solution might break when new icons are added or when the underlying icon library is updated, potentially causing visual inconsistencies. Suggested changeInvestigate the root cause of the icon alignment issues and implement a more robust solution, possibly by properly configuring the icon component's baseline alignment or using proper spacing properties. Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.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. @rusackas curious if this hack will solve your alignment issue on that other PR (?) |
||
} | ||
font-size: ${({ iconSize, theme }) => | ||
iconSize | ||
? `${theme.typography.sizes[iconSize] || theme.typography.sizes.m}px` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,6 @@ test('works with an onClick handler', () => { | |
test('renders all the storybook gallery variants', () => { | ||
const { container } = render(<LabelGallery />); | ||
expect(container.querySelectorAll('.ant-tag')).toHaveLength( | ||
options.length * 2, | ||
options.length * 2 + 4, | ||
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. Can we use a named constant for that |
||
); | ||
}); |
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.
This change is improving the
Theme Colors
storybook as I kind of needed that to see throught his PR. Not directly related to the PR but helpful overall.