Skip to content
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

feat: update start and normal width calc #183

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,26 @@ export const AbsenceItem: FC<Props> = ({ absence, userName, overflowType }) => {
const boxSize = isMobile ? '36px' : '48px'
const durationPlusLast = duration + 1

//The calculation of end is based on the duration of the absence plus an element to reach the end of the block,
// minus 1px for each block present due to the margin each one has,
// and subtracting the cell's padding to ensure it accounts for the same padding at the beginning and end.

if (overflowType === 'end') {
return `calc(${durationPlusLast * 100}% + ${durationPlusLast - 1}px - ${cellPadding})`
return `calc(${durationPlusLast * 100}% + ${duration}px - ${cellPadding})`
}

//The calc is based in total width plus 1px for each block present due to the margin each one has
if (overflowType === 'both') {
return `calc(${durationPlusLast * 100}% + ${durationPlusLast - 1}px)`
return `calc(${durationPlusLast * 100}% + ${duration}px)`
}

//The calculation is based on the duration of the absence plus an element to reach the end of the block, minus 1px for each block present due to the margin each one has, and subtracting the padding that we lose at the beginning.
if (overflowType === 'start') {
return `calc(${durationPlusLast * 100}%)`
return `calc(${durationPlusLast * 100}% + ${duration}px - ${cellPadding})`
}

return `calc(${duration * 100}% + ${boxSize})`
//The calculation is based on the duration of the absence plus an element to reach the end of the block, minus 1px for each block present due to the margin each one has, and adding the block size without padding.
return `calc(${duration * 100}% + ${boxSize} + ${duration}px)`
}

const getBorderRadius = () => {
Expand Down
Loading