-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Custom buttons draft * Fixed build and remove custom buttons to make sure tests are passing * Updated top toolbar snapshot
- Loading branch information
1 parent
54514fe
commit d334270
Showing
17 changed files
with
262 additions
and
50 deletions.
There are no files selected for viewing
Binary file modified
BIN
-1.78 KB
(91%)
...er-Toolbars-on-the-right-and-bottom-visible-when-zoomed-in-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
49 changes: 49 additions & 0 deletions
49
packages/ketcher-react/src/components/Buttons/IconButton/IconButtonBase.tsx
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,49 @@ | ||
/**************************************************************************** | ||
* Copyright 2021 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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 specific language governing permissions and | ||
* limitations under the License. | ||
***************************************************************************/ | ||
|
||
import { StyledButton } from './styles'; | ||
import { IIconButtonBaseProps } from './types'; | ||
|
||
export const IconButtonBase = ({ | ||
onClick, | ||
shortcut, | ||
title, | ||
className, | ||
isActive = false, | ||
isHidden = false, | ||
disabled = false, | ||
testId, | ||
children, | ||
}: IIconButtonBaseProps) => { | ||
const combinedTitle = shortcut ? `${title} (${shortcut})` : title; | ||
|
||
if (isHidden) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<StyledButton | ||
className={className} | ||
title={combinedTitle} | ||
onClick={onClick} | ||
disabled={disabled} | ||
isActive={isActive} | ||
data-testid={testId} | ||
> | ||
{children} | ||
</StyledButton> | ||
); | ||
}; |
30 changes: 30 additions & 0 deletions
30
packages/ketcher-react/src/components/Buttons/IconButton/IconButtonCustomIcon.tsx
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,30 @@ | ||
/**************************************************************************** | ||
* Copyright 2021 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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 specific language governing permissions and | ||
* limitations under the License. | ||
***************************************************************************/ | ||
|
||
import { IIconButtonCustomIconProps } from './types'; | ||
import { IconButtonBase } from './IconButtonBase'; | ||
import { StyledCustomIcon } from './styles'; | ||
|
||
export const IconButtonCustomIcon = ({ | ||
link, | ||
...props | ||
}: IIconButtonCustomIconProps) => { | ||
return ( | ||
<IconButtonBase {...props}> | ||
<StyledCustomIcon src={link} alt={props.title} /> | ||
</IconButtonBase> | ||
); | ||
}; |
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
5 changes: 5 additions & 0 deletions
5
packages/ketcher-react/src/script/builders/ketcher/CustomButtons.ts
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,5 @@ | ||
export interface CustomButton { | ||
id: string; | ||
imageLink: string; | ||
title: string; | ||
} |
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
Oops, something went wrong.