Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

refactor(sheets-hyper-link-ui): remove LESS styles and replace with Tailwind CSS (#5129)

ZhangWei1abce4b37ad8
diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.module.less b/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.module.less
deleted file mode 100644
index 554f9245c2..0000000000
--- a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.module.less
+++ /dev/null
@@ -1,16 +0,0 @@
-.cell-link-edit {
- padding: 16px;
- background-color: rgb(var(--color-white));
- box-sizing: border-box;
- width: 296px;
- box-sizing: border-box;
- border-radius: var(--border-radius-xl);
- border: 1px solid rgb(var(--grey-200));
- box-shadow: 0px 4px 10px -1px rgba(17, 22, 40, 0.1);
-}
-
-.cell-link-edit-buttons {
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
-}
diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx b/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx
index 7b5e9843ab..9a1b079625 100644
--- a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx
+++ b/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx
@@ -34,7 +34,6 @@ import { SheetsHyperLinkPopupService } from '../../services/popup.service';
import { SheetsHyperLinkResolverService } from '../../services/resolver.service';
import { SheetsHyperLinkSidePanelService } from '../../services/side-panel.service';
import { HyperLinkEditSourceType } from '../../types/enums/edit-source';
-import styles from './index.module.less';
export const CellLinkEdit = () => {
const [id, setId] = useState('');
@@ -416,7 +415,12 @@ export const CellLinkEdit = () => {
}
return (
- <div className={styles.cellLinkEdit} style={{ display: hide ? 'none' : 'block' }}>
+ <div
+ className={`
+ univer-box-border univer-w-[296px] univer-rounded-xl univer-border univer-border-solid
+ univer-border-gray-200 univer-bg-white univer-p-4 univer-shadow-md
+ `}
+ >
{showLabel
? (
<FormLayout
@@ -442,6 +446,7 @@ export const CellLinkEdit = () => {
: null}
<FormLayout label={localeService.t('hyperLink.form.type')}>
<Select
+ className="univer-w-full"
options={linkTypeOptions}
value={type}
onChange={(newType) => {
@@ -458,7 +463,7 @@ export const CellLinkEdit = () => {
value={payload}
onChange={(newLink) => {
setPayload(newLink);
- if (newLink && (setByPayload.current || !display || display === payload)) {
+ if (newLink && (setByPayload.current || !display || display === newLink)) {
setDisplay(newLink);
setByPayload.current = true;
}
@@ -524,6 +529,7 @@ export const CellLinkEdit = () => {
{type === SheetHyperLinkType.SHEET && (
<FormLayout error={showError && !payload ? localeService.t('hyperLink.form.selectError') : ''}>
<Select
+ className="univer-w-full"
options={sheetsOption}
value={payload}
onChange={(newPayload) => {
@@ -541,6 +547,7 @@ export const CellLinkEdit = () => {
{type === SheetHyperLinkType.DEFINE_NAME && (
<FormLayout error={showError && !payload ? localeService.t('hyperLink.form.selectError') : ''}>
<Select
+ className="univer-w-full"
options={definedNames}
value={payload}
onChange={(newValue) => {
@@ -569,7 +576,7 @@ export const CellLinkEdit = () => {
setPayload={setPayload}
/>
)}
- <div className={styles.cellLinkEditButtons}>
+ <div className="univer-flex univer-flex-row univer-justify-end">
<Button
onClick={() => {
if (editing) {
diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.module.less b/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.module.less
deleted file mode 100644
index e355a810d5..0000000000
--- a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.module.less
+++ /dev/null
@@ -1,84 +0,0 @@
-.cell-link {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- padding: 12px;
- box-shadow: var(--box-shadow-base);
- border-radius: 8px;
- border: 1px solid rgb(var(--grey-200));
- background: rgb(var(--color-white));
- max-width: 328px;
- overflow: hidden;
- margin-bottom: var(--margin-xxs);
-}
-
-.cell-link-type {
- height: 20px;
- width: 20px;
- font-size: 16px;
- margin-right: 8px;
- display: flex;
- align-items: center;
- justify-content: center;
- flex: 0 0 auto;
- color: rgb(var(--color-black));
-}
-
-.cell-link-content {
- height: 24px;
- display: flex;
- flex-direction: row;
- align-items: center;
- font-size: 13px;
- line-height: 20px;
- color: rgb(var(--blue-500));
- cursor: pointer;
- flex: 1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.cell-link-content-error {
- color: rgb(var(--grey-500));
-}
-
-.cell-link-url {
- flex: 1;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.cell-link-operations {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- height: 24px;
- flex-basis: auto;
- flex-grow: 0;
- flex-shrink: 0;
-}
-
-.cell-link-operation {
- width: 24px;
- height: 24px;
- border-radius: 4px;
- margin-left: 8px;
- font-size: 16px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- border-radius: 4px;
-}
-
-.cell-link-operation-error {
- color: rgb(var(--grey-500));
-}
-
-.cell-link-operation:hover {
- background: #ccc;
-}
diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx b/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx
index 169bcc5037..b71739334e 100644
--- a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx
+++ b/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx
@@ -27,7 +27,6 @@ import { OpenHyperLinkEditPanelOperation } from '../../commands/operations/popup
import { SheetsHyperLinkPopupService } from '../../services/popup.service';
import { SheetsHyperLinkResolverService } from '../../services/resolver.service';
import { HyperLinkEditSourceType } from '../../types/enums/edit-source';
-import styles from './index.module.less';
const iconsMap = {
[SheetHyperLinkType.URL]: <LinkSingle />,
@@ -66,9 +65,20 @@ export const CellLinkPopupPure = (props: ICellLinkPopupPureProps) => {
const isError = linkObj.type === SheetHyperLinkType.INVALID;
return (
- <div className={styles.cellLink} onClick={() => popupService.hideCurrentPopup()}>
+ <div
+ className={`
+ univer-mb-1 univer-flex univer-max-w-[328px] univer-flex-row univer-items-center univer-justify-between
+ univer-overflow-hidden univer-rounded-lg univer-border univer-border-solid univer-border-gray-200
+ univer-bg-white univer-p-3 univer-shadow-md
+ `}
+ onClick={() => popupService.hideCurrentPopup()}
+ >
<div
- className={clsx(styles.cellLinkContent, { [styles.cellLinkContentError]: isError })}
+ className={clsx(`
+ univer-flex univer-h-6 univer-flex-1 univer-cursor-pointer univer-flex-row univer-items-center
+ univer-overflow-hidden univer-text-ellipsis univer-whitespace-nowrap univer-text-sm univer-leading-5
+ univer-text-blue-500
+ `, { 'univer-text-gray-500': isError })}
onClick={() => {
if (zenZoneService.visible) {
return;
@@ -81,17 +91,30 @@ export const CellLinkPopupPure = (props: ICellLinkPopupPureProps) => {
resolverService.navigate(linkObj);
}}
>
- <div className={styles.cellLinkType}>
+ <div
+ className={`
+ univer-mr-2 univer-flex univer-h-5 univer-w-5 univer-flex-none univer-items-center
+ univer-justify-center univer-text-base univer-text-black
+ `}
+ >
{iconsMap[linkObj.type]}
</div>
<Tooltip showIfEllipsis title={linkObj.name} asChild>
- <span className={styles.cellLinkUrl}>{linkObj.name}</span>
+ <span className="univer-flex-1 univer-overflow-hidden univer-text-ellipsis">{linkObj.name}</span>
</Tooltip>
</div>
- <div className={styles.cellLinkOperations}>
+ <div
+ className={`
+ univer-flex univer-h-6 univer-flex-none univer-flex-row univer-items-center univer-justify-center
+ `}
+ >
{copyPermission && (
<div
- className={clsx(styles.cellLinkOperation, { [styles.cellLinkOperationError]: isError })}
+ className={clsx(`
+ univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-flex-row
+ univer-items-center univer-justify-center univer-rounded univer-text-base
+ hover:univer-bg-gray-200
+ `, { 'univer-text-gray-500': isError })}
onClick={() => {
if (isError) {
return;
@@ -112,13 +135,16 @@ export const CellLinkPopupPure = (props: ICellLinkPopupPureProps) => {
<Tooltip placement="bottom" title={localeService.t('hyperLink.popup.copy')}>
<CopySingle />
</Tooltip>
-
</div>
)}
{editPermission && (
<>
<div
- className={styles.cellLinkOperation}
+ className={`
+ univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-flex-row
+ univer-items-center univer-justify-center univer-rounded univer-text-base
+ hover:univer-bg-gray-200
+ `}
onClick={() => {
commandService.executeCommand(OpenHyperLinkEditPanelOperation.id, {
unitId,
@@ -135,7 +161,11 @@ export const CellLinkPopupPure = (props: ICellLinkPopupPureProps) => {
</Tooltip>
</div>
<div
- className={styles.cellLinkOperation}
+ className={`
+ univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-flex-row
+ univer-items-center univer-justify-center univer-rounded univer-text-base
+ hover:univer-bg-gray-200
+ `}
onClick={() => {
const commandId = (type === HyperLinkEditSourceType.EDITING || type === HyperLinkEditSourceType.ZEN_EDITOR) ? CancelRichHyperLinkCommand.id : CancelHyperLinkCommand.id;
if (commandService.syncExecuteCommand(commandId, {