mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 06:21:11 +00:00 
			
		
		
		
	Followup to https://codeberg.org/forgejo/forgejo/pulls/6459. Usually it's quite hard to have inputs with balanced size that works for both desktop and mobile: it's either too large or too small for one of them. I think this can be a solution for this new element. I tried it locally, it feels good on a phone. There's likely one downside which is that the switch will still be larger on touch devices even when they're wide, like on tablets. I think it can be resolved separately at some point. It isn't a problem on small devices because usually these elements go on separate rows. ## Preview This change only affects touch devices. |Before|After| |-|-| ||| Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6546 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			655 B
		
	
	
	
		
			CSS
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			655 B
		
	
	
	
		
			CSS
		
	
	
	
	
	
| .switch {
 | |
|   display: grid;
 | |
|   grid-auto-flow: column;
 | |
|   height: fit-content;
 | |
|   align-items: center;
 | |
|   align-self: center;
 | |
|   background: var(--color-menu);
 | |
|   border: 1px solid var(--color-input-border);
 | |
|   border-radius: var(--border-radius);
 | |
| }
 | |
| 
 | |
| .switch .item {
 | |
|   display: flex;
 | |
|   align-items: center;
 | |
|   padding: .5em 1.125em;
 | |
|   color: var(--color-text);
 | |
|   border-radius: var(--border-radius);
 | |
|   text-wrap: nowrap;
 | |
| }
 | |
| 
 | |
| .switch .active.item {
 | |
|   background: var(--color-active);
 | |
|   outline: 1px solid var(--color-input-border);
 | |
| }
 | |
| 
 | |
| @media (pointer: coarse) {
 | |
|   .switch .item {
 | |
|     padding: .75em 1.125em;
 | |
|   }
 | |
| }
 | |
| 
 | |
| .switch button.item {
 | |
|   background: transparent;
 | |
| }
 |