forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [bento][amp-accordion] CSS Port draft for amp accordion (PR ampproj…
…ect#2) (ampproject#30622) * Update CSS for accordion * Add JSX into Preact component styling and misc review comments * Add important to make section styles impossible to overwrite * Add tests for CSS in amp-accordion * Accordion tests updates * Removed tests for getComputedStyle * Remove debugging comments * Address nits from review
- Loading branch information
Showing
7 changed files
with
172 additions
and
25 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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright 2020 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import {createUseStyles} from 'react-jss'; | ||
|
||
const sectionChild = { | ||
// Make animations measurable. Without this, padding and margin can skew | ||
// animations. | ||
boxSizing: 'border-box !important', | ||
// Cancel out the margin collapse. Also helps with animations to avoid | ||
// overflow. | ||
overflow: 'hidden !important', | ||
// Ensure that any absolute elements are positioned within the section. | ||
position: 'relative !important', | ||
}; | ||
|
||
// TODO(#30445): update these styles after team agrees on styling | ||
const header = { | ||
cursor: 'pointer', | ||
backgroundColor: '#efefef', | ||
paddingRight: '20px', | ||
border: 'solid 1px #dfdfdf', | ||
}; | ||
|
||
// TODO(#30445): update these styles after team agrees on styling | ||
// or delete if not used | ||
const content = {}; | ||
|
||
const JSS = { | ||
sectionChild, | ||
header, | ||
content, | ||
}; | ||
|
||
// useStyles gets replaced for AMP builds via `babel-plugin-transform-jss`. | ||
// eslint-disable-next-line local/no-export-side-effect | ||
export const useStyles = createUseStyles(JSS); |
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