PromucFlow_constructor/app/client/src/components/utils/helperComponents.tsx
Ankita Kinger 5e6dd189fd
chore: Updating link component props (#27223)
## Description

Updating existing link component usage to use the correct props and
remove `e.preventDefault()` when not required, as we have updated the DS
Link component implementation

#### PR fixes following issue(s)
Fixes [#583](https://github.com/appsmithorg/design-system/issues/583)

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [x] Cypress

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-09-14 16:14:23 +05:30

64 lines
1.3 KiB
TypeScript

import React from "react";
import styled, { createGlobalStyle } from "styled-components";
import { useHistory } from "react-router-dom";
import { truncateTextUsingEllipsis } from "constants/DefaultTheme";
import { Link, Text } from "design-system";
export const HelpPopoverStyle = createGlobalStyle`
.bp3-portal {
.delete-menu-item {
.cs-icon, .cs-text {
color: var(--appsmith-color-red-500) !important;
svg {
path {
fill: var(--appsmith-color-red-500) !important;
}
}
}
}
}
`;
export const StyledBackLink = styled(Link)`
display: inline-flex;
margin: 0 0 var(--ads-v2-spaces-7) 0;
`;
export const SettingsHeader = styled(Text)`
padding: 0px 8px 0 0;
margin-bottom: 0px;
width: 365px;
${truncateTextUsingEllipsis}
`;
export const StickyHeader = styled.div`
position: sticky;
top: 0;
background: var(--ads-v2-color-bg);
padding-bottom: 8px;
z-index: 4;
`;
export function BackButton({ goTo }: { goTo?: string }) {
const history = useHistory();
const onBack = () => {
if (goTo) {
history.push(goTo);
return;
}
history.goBack();
};
return (
<StyledBackLink
className="t--admin-settings-back-button"
kind="secondary"
onClick={onBack}
startIcon="back-control"
>
Back
</StyledBackLink>
);
}