-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Social Links: Add ability to change social icon sizes (#25921)
* Social Links: Add variables to change icon sizes This adds CSS custom properties to alter the circle/logo sizes. I'm not quite sure how to integrate this in to make it adjustable, maybe as a theme.json optoin? First, we may want to create as fixed sizes (sm, med, large) to make sure things look right. There are two values to adjust, the outer circle and the inner logo. So it is possible to make the icons all out of sorts if the sizes don't match properly. * Switch social links to fixed sizes Uses small, normal, large, and huge sizes matching the same presets as the font sizes. Uses the CustomSelectControl to pick which size Introduces class names `has-SIZE-icon-size` that applies to social link * Ensure that icons aren't cut off by their button container in the editor. * Switch size control to toolbar * Add check icon for selected menuitem * Add isAlternate prop for Dropdown * Initial refactor work. * Refactor to use ems. * Small tweaks. * Fix variations. * Get the setup state working. * Don't size up placeholder state on hover. * Add checkmark to normal size even if not set The default size is normal, even if the iconsize is not set, so this sets the checkmark in the dropdown to reflect. * Use math for nicer padding. Props @kirilzh * Add specificity to margins to fix a theme issue. * iconSize -> size * Hover cleanup. * Try using DropdownMenu component * Fix calc. * Try text for button instead of icon A test to see what we think of modifying the DropdownMenu/Button to accept a text property which when specified and icon=null than it will show instead of the icon. * Add popover props for isAlternate * Display size name as label Switches the button to display the name as the label for example "Large" instead of just showing "Size" Fix issue with { onClose } not being destructured Pass toggleProps forward. * Switch back to 'Size' in toolbar Co-authored-by: Kjell Reigstad <kjell@kjellr.com> Co-authored-by: jasmussen <joen@automattic.com>
- Loading branch information
1 parent
24a4f44
commit 422b21c
Showing
6 changed files
with
188 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
.wp-block-social-links .wp-social-link button { | ||
color: currentColor; | ||
padding: 6px; | ||
// The editor uses the button component, the frontend uses a link. | ||
// Therefore we unstyle the button component to make it more like the frontend. | ||
.wp-block-social-links .wp-social-link { | ||
line-height: 0; | ||
|
||
button { | ||
font-size: inherit; | ||
color: currentColor; | ||
height: auto; | ||
line-height: 0; | ||
|
||
// This rule is duplicated from the style.scss and needs to be the same as there. | ||
padding: 0.25em; | ||
} | ||
} | ||
|
||
.wp-block-social-links.is-style-pill-shape .wp-social-link button { | ||
padding-left: 16px; | ||
padding-right: 16px; | ||
padding-left: calc((2/3) * 1em); | ||
padding-right: calc((2/3) * 1em); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters