-
Notifications
You must be signed in to change notification settings - Fork 45
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
build: added new component to list the ordered, unordered list #1533
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## List Block | ||
|
||
This an exmaple of showing list | ||
|
||
<ListBlock slots="text1, text2" repeat="4" iconColor="#2ac3a2" icon="checkmark" variant="fullWidth" /> | ||
|
||
500 free Document Transactions per month | ||
|
||
Volume and multi-product discounts | ||
|
||
Access to all 15+ PDF Services including PDF Extract, PDF Accessibility Auto-Tag API, and Document Generation | ||
|
||
Access to all 15+ PDF Services including PDF Extract, PDF Accessibility Auto-Tag API, and Document Generation | ||
|
||
Easy to sign up and create credentials in minutes | ||
|
||
Technical Support included (different tiers available) | ||
|
||
No credit card or commitment required | ||
|
||
Scalable for high volume needs. |
125 changes: 125 additions & 0 deletions
125
packages/gatsby-theme-aio/src/components/ListBlock/index.js
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,125 @@ | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you 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 REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
|
||
import React from "react" | ||
import { css } from '@emotion/react'; | ||
import PropTypes from "prop-types"; | ||
import classNames from "classnames"; | ||
|
||
const commonCSS = ` | ||
width: 45%; | ||
margin: 0 !important; | ||
|
||
@media screen and (min-width:320px) and (max-width:767px) { | ||
width : 90% !important; | ||
}` | ||
|
||
const List = ({ icon, iconColor, listItem, content }) => { | ||
|
||
const bulletIcons = icon ?? "checkmark"; | ||
|
||
return ( | ||
<ul css={css` ${commonCSS}`}> | ||
{listItem?.map((data, index) => { | ||
const shouldHideBullet = bulletIcons === "checkmark" || (content === "right" && data?.text1 === undefined) || (content === "left" && data?.text2 === undefined); | ||
return ( | ||
<li | ||
key={index} | ||
css={css` | ||
list-style: ${shouldHideBullet ? "none " : bulletIcons}; | ||
font-size: 1.5em; | ||
position: ${bulletIcons === "checkmark" && "relative"}; | ||
padding-left: ${bulletIcons === "checkmark" && "1.5em"}; | ||
&::marker { | ||
color: ${iconColor}; | ||
} | ||
|
||
& > p{ | ||
margin: var(--spectrum-global-dimension-size-150) 0 !important; | ||
} | ||
|
||
${bulletIcons === "checkmark" && | ||
`&:before { | ||
content: "\u2713"; | ||
position: absolute; | ||
left:0; | ||
top: 0; | ||
color: ${iconColor}; | ||
}` | ||
} | ||
`}> | ||
{content === "right" ? data?.text1 : data?.text2} | ||
</li> | ||
) | ||
})} </ul> | ||
) | ||
} | ||
|
||
const ListBlock = ({ | ||
className, | ||
icon, | ||
variant = "halfWidth", | ||
iconColor = "black", | ||
repeat, | ||
...props | ||
}) => { | ||
|
||
const propKeys = Object?.keys(props); | ||
const listItem = propKeys.filter((key) => key.startsWith("text2")).map((data, index) => { | ||
return { | ||
text1: props[data], | ||
text2: repeat === "1" || repeat === undefined ? props["text1"] : props[`text1${index}`], | ||
}; | ||
}); | ||
|
||
return ( | ||
<section | ||
className={classNames(className)} | ||
css={css` | ||
margin:auto; | ||
padding : 4% 0; | ||
width : ${variant === "halfWidth" ? "60%" : "100%"}; | ||
`} | ||
> | ||
<div> | ||
<div | ||
css={css` | ||
display : flex; | ||
justify-content: space-between; | ||
text-align : left; | ||
|
||
@media screen and (min-width:320px) and (max-width:767px) { | ||
flex-direction:column; | ||
} | ||
|
||
`} | ||
> | ||
<List listItem={listItem} iconColor={iconColor} icon={icon} content="left" /> | ||
|
||
<div css={css`border-right: 1px solid var(--spectrum-global-color-gray-300)`}></div> | ||
|
||
<List listItem={listItem} iconColor={iconColor} icon={icon} content="right" /> | ||
|
||
</div> | ||
</div> | ||
</section> | ||
) | ||
} | ||
|
||
ListBlock.propTypes = { | ||
className: PropTypes.string, | ||
icon: PropTypes.string, | ||
iconColor: PropTypes.string, | ||
variant: PropTypes.string, | ||
}; | ||
|
||
export { ListBlock } |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain further on how each child will be rendered? When I look at a list, I thought the children are rendering as a list and first 4 items are on the left and last 4 items are on the right. Instead, right now it's rendering from left and right with 1,3,5,7 on left and 2,4,6,8 on right. We could have this behaviour but please explain better so the user understand how they would should put their content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some content information on the README