forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
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
More route nav id fixe #2
Open
lizard-boy
wants to merge
17
commits into
main
Choose a base branch
from
more-route-navId-fixe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4484a14
First stab at new page layouts behind feature toggle
torkelo fa13c58
Merge branch 'main' of github.com:grafana/grafana into new-page-layouts
torkelo 3a03bbb
Simplifying PageHeader
torkelo 3efb292
Merge branch 'page-refactorings' into new-page-layout-poc
torkelo b316e50
Progress on a new model that can more easily support new and old page…
torkelo 9cfbc2b
Progress
torkelo 008f275
rename folder
torkelo 1a0fee2
Progress
torkelo 59a0765
Minor change
torkelo 80f1243
fixes
torkelo d68133e
Fixing tests
torkelo 9a1a6a8
Make breadcrumbs work
torkelo 6dd87ce
Add tests for old Page component
torkelo 5b9bfb0
Adding tests for new Page component and behavior
torkelo edbf2ef
Merge branch 'main' of github.com:grafana/grafana into new-page-layouts
torkelo 427a2d3
fixing page header test
torkelo 3712699
Fixed test
torkelo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { css, cx } from '@emotion/css'; | ||
import React from 'react'; | ||
|
||
import { GrafanaTheme2 } from '@grafana/data'; | ||
import { selectors } from '@grafana/e2e-selectors'; | ||
|
||
import { useStyles2 } from '../../themes/ThemeContext'; | ||
import { Icon } from '../Icon/Icon'; | ||
|
||
import { Counter } from './Counter'; | ||
import { TabProps } from './Tab'; | ||
|
||
export const VerticalTab = React.forwardRef<HTMLAnchorElement, TabProps>( | ||
({ label, active, icon, counter, className, suffix: Suffix, onChangeTab, href, ...otherProps }, ref) => { | ||
const tabsStyles = useStyles2(getTabStyles); | ||
const content = () => ( | ||
<> | ||
{icon && <Icon name={icon} />} | ||
{label} | ||
{typeof counter === 'number' && <Counter value={counter} />} | ||
{Suffix && <Suffix className={tabsStyles.suffix} />} | ||
</> | ||
); | ||
|
||
const linkClass = cx(tabsStyles.link, active && tabsStyles.activeStyle); | ||
|
||
return ( | ||
<li className={tabsStyles.item}> | ||
<a | ||
href={href} | ||
className={linkClass} | ||
{...otherProps} | ||
onClick={onChangeTab} | ||
aria-label={otherProps['aria-label'] || selectors.components.Tab.title(label)} | ||
role="tab" | ||
aria-selected={active} | ||
ref={ref} | ||
> | ||
{content()} | ||
</a> | ||
</li> | ||
); | ||
} | ||
); | ||
|
||
VerticalTab.displayName = 'Tab'; | ||
|
||
const getTabStyles = (theme: GrafanaTheme2) => { | ||
return { | ||
item: css` | ||
list-style: none; | ||
margin-right: ${theme.spacing(2)}; | ||
position: relative; | ||
display: block; | ||
margin-bottom: 4px; | ||
`, | ||
link: css` | ||
padding: 6px 12px; | ||
display: block; | ||
height: 100%; | ||
cursor: pointer; | ||
|
||
color: ${theme.colors.text.primary}; | ||
|
||
svg { | ||
margin-right: ${theme.spacing(1)}; | ||
} | ||
|
||
&:hover, | ||
&:focus { | ||
text-decoration: underline; | ||
} | ||
`, | ||
activeStyle: css` | ||
label: activeTabStyle; | ||
color: ${theme.colors.text.maxContrast}; | ||
font-weight: 500; | ||
overflow: hidden; | ||
|
||
&::before { | ||
display: block; | ||
content: ' '; | ||
position: absolute; | ||
left: 0; | ||
width: 4px; | ||
bottom: 0; | ||
top: 0; | ||
border-radius: 2px; | ||
background-image: linear-gradient(0deg, #f05a28 30%, #fbca0a 99%); | ||
} | ||
`, | ||
suffix: css` | ||
margin-left: ${theme.spacing(1)}; | ||
`, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
style: displayName 'Tab' may be confusing since this is VerticalTab component