Skip to content

Commit

Permalink
fix(ui): use appropriate cursor type for disabled UI elements (#1184)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCatLady committed Mar 16, 2021
1 parent d71b48a commit b767a58
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/components/Slider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ const Slider: React.FC<SliderProps> = ({
<div className="absolute right-0 flex -mt-10 text-gray-400">
<button
className={`${
scrollPos.isStart
? 'cursor-not-allowed text-gray-800'
: 'hover:text-white'
scrollPos.isStart ? 'text-gray-800' : 'hover:text-white'
}`}
onClick={() => slide(Direction.LEFT)}
disabled={scrollPos.isStart}
Expand All @@ -187,9 +185,7 @@ const Slider: React.FC<SliderProps> = ({
</button>
<button
className={`${
scrollPos.isEnd
? 'cursor-not-allowed text-gray-800'
: 'hover:text-white'
scrollPos.isEnd ? 'text-gray-800' : 'hover:text-white'
}`}
onClick={() => slide(Direction.RIGHT)}
disabled={scrollPos.isEnd}
Expand Down
17 changes: 11 additions & 6 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ img.avatar-sm {
@apply flex max-w-lg rounded-md shadow-sm;
}

textarea {
@apply flex-1 block w-full min-w-0 text-white transition duration-150 ease-in-out bg-gray-700 border border-gray-500 rounded-md form-input sm:text-sm sm:leading-5;
}

.label-required {
@apply text-red-500;
}
Expand All @@ -206,14 +202,22 @@ label.text-label {
@apply sm:mt-2;
}

button,
input,
select,
textarea {
@apply disabled:cursor-not-allowed;
}

input[type='checkbox'] {
@apply w-6 h-6 text-indigo-600 transition duration-150 ease-in-out rounded-md;
}

input[type='text'],
input[type='password'],
select {
@apply flex-1 block w-full min-w-0 text-white transition duration-150 ease-in-out bg-gray-700 border border-gray-500 rounded-md form-input sm:text-sm sm:leading-5;
select,
textarea {
@apply flex-1 block w-full min-w-0 text-white transition duration-150 ease-in-out bg-gray-700 border border-gray-500 rounded-md sm:text-sm sm:leading-5;
}

input.rounded-l-only,
Expand All @@ -234,6 +238,7 @@ select.short {
.protocol {
@apply inline-flex items-center px-3 text-gray-100 bg-gray-600 border border-r-0 border-gray-500 cursor-default rounded-l-md sm:text-sm;
}

.error {
@apply mt-2 text-sm text-red-500;
}
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module.exports = {
},
},
variants: {
cursor: ['disabled'],
padding: ['first', 'last', 'responsive'],
borderWidth: ['first', 'last'],
margin: ['first', 'last', 'responsive'],
Expand Down

0 comments on commit b767a58

Please sign in to comment.