Skip to content

Commit

Permalink
[薪資解鎖] 樣式更新 (#1091)
Browse files Browse the repository at this point in the history
* One lock per row

* Update style

* Remove margin-right to the icon

* Fix padding on small devices

* Fix lint

* Add comments
  • Loading branch information
peteranny authored May 4, 2023
1 parent 2bcf9c4 commit 5730c86
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
33 changes: 18 additions & 15 deletions src/components/TimeAndSalary/common/injectHideContentBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export default hideRange => rows => {
const hideIndex = hideRange[0];
const nHides = hideRange.length;
const shareLink = useShareLink();

// Replace original cells with locked cells
// on small screens
rows.forEach(row => {
row.props.children.splice(
hideIndex,
Expand All @@ -26,21 +29,21 @@ export default hideRange => rows => {
}),
);
});

// Add locked cells on regular screens
// that spans multiple columns
if (rows.length > 0) {
rows[0].props.children.splice(
hideIndex,
0,
<td
key="__hideContent"
colSpan={nHides}
rowSpan={rows.length}
className={styles.cell}
>
<BasicPermissionSimpleBlock
to={shareLink}
rootClassName={styles.hideContentBlock}
/>
</td>,
);
for (let i = 0; i < rows.length; i++) {
rows[i].props.children.splice(
hideIndex,
0,
<td key="__hideContent" colSpan={nHides} className={styles.cell}>
<BasicPermissionSimpleBlock
to={shareLink}
rootClassName={styles.hideContentBlock}
/>
</td>,
);
}
}
};
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
@value below-small, above-small from "common/variables.module.css";

td.cell {
position: relative;

.hideContentBlock {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
top: 13px;
left: 13px;
right: 13px;
bottom: 13px;
display: flex;
@media (max-width: 850px) {
@media (max-width: below-small) {
top: 3px;
left: 120px;
right: 3px;
bottom: 3px;
}
}

@media (max-width: 850px) {
@media (max-width: below-small) {
display: none !important;
}

&.mobile {
display: flex !important;

@media (min-width: 850px) {
@media (min-width: above-small) {
display: none !important;
}
}
Expand Down
18 changes: 6 additions & 12 deletions src/components/common/PermissionBlock/PermissionBlock.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@value above-small, below-small, link-blue from "common/variables.module.css";
@value above-small, below-small, above-desktop, main-yellow, link-blue from "common/variables.module.css";

.permissionBlock {
display: inline-block;
Expand All @@ -15,9 +15,8 @@
}

.permissionSimpleBlock {
border: 1px solid #fcd406;
border-radius: 0px;
background-color: #fffbe8;
border: 1px solid main-yellow;
border-radius: 4px;

.container {
max-width: 500px;
Expand All @@ -28,7 +27,7 @@
.simple {
cursor: pointer;

@media (min-width: 1025px) {
@media (min-width: above-desktop) {
&:hover {
.headingIcon {
color: link-blue;
Expand Down Expand Up @@ -67,12 +66,7 @@

.headingIcon {
display: inline;
font-size: 24px;
margin-right: 10px;

@media (max-width: 850px) {
font-size: 16px;
}
font-size: 16px;
}

.heading {
Expand All @@ -84,7 +78,7 @@
justify-content: space-around;
flex-wrap: nowrap;

@media (max-width: 850px) {
@media (max-width: above-small) {
flex-direction: column;
height: 8rem;
align-items: center;
Expand Down

0 comments on commit 5730c86

Please sign in to comment.