Skip to content
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

[#91] Auction style #107

Merged
merged 16 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.yml]
[{*.yml,*.json}]
indent_style = space
indent_size = 2

Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,5 @@ vendor
# PhpStorm
.idea/

# Pre-compiled files
src/index.js
src/components

# Credentials
auth.json
18 changes: 18 additions & 0 deletions client-mu-plugins/goodbids/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
22 changes: 22 additions & 0 deletions client-mu-plugins/goodbids/.gitignore
nathan-schmidt-viget marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

dist
build
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,51 @@
return;
endif;
?>
<section <?php block_attr( $block ); ?>>
<section <?php block_attr( $block, 'flex gap-5 my-4 flex-wrap' ); ?>>
<?php
// Goal.
if ( $goal ) :
printf(
'<p style="text-align: center;">%s</p>',
esc_html__( wc_price( $goal ), 'goodbids' )
);
endif;
?>
<div class="flex flex-col text-center">
<p class="m-0 uppercase font-thin has-x-small-font-size"><?php esc_html_e( 'Auction Goal', 'goodbids' ); ?></p>
<?php
Comment on lines +29 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we lost the indention formatting here.

printf(
'<p class="m-1 font-extrabold">%s</p>',
wp_kses_post( wc_price( $goal ) )
);
?>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

<?php endif; ?>

<?php
// Estimated Value.
if ( $estimated_value ) :
printf(
'<p style="text-align: center;">%s</p>',
esc_html__( wc_price( $estimated_value ), 'goodbids' )
);
endif;
?>
<div class="flex flex-col text-center">
<p class="m-0 uppercase font-thin has-x-small-font-size"><?php esc_html_e( 'Auction Goal', 'goodbids' ); ?></p>
<?php
Comment on lines +44 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here.

printf(
'<p class="m-1 font-extrabold">%s</p>',
wp_kses_post( wc_price( $estimated_value ) )
);
?>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

<?php endif; ?>

<?php
// Expected High Bid.
if ( $expected_high_bid ) :
printf(
'<p style="text-align: center;">%s</p>',
esc_html__( wc_price( $expected_high_bid ), 'goodbids' )
);
endif;
?>
?>
<div class="flex flex-col text-center">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lastly here.

<p class="m-0 uppercase font-thin has-x-small-font-size"><?php esc_html_e( 'Auction Goal', 'goodbids' ); ?></p>
<?php
printf(
'<p class="m-1 font-extrabold">%s</p>',
wp_kses_post( wc_price( $expected_high_bid ) )
);
?>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lastly here-final-final-v3



<?php endif; ?>
</section>
4 changes: 2 additions & 2 deletions client-mu-plugins/goodbids/blocks/bid-now/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ public function display(): bool {
* @return string
*/
public function get_button_text(): string {
$button_text = __( 'Bid Now', 'goodbids' );
$button_text = __( 'GOODBID Now', 'goodbids' );

if ( $this->bid_product_id && ! is_admin() ) {
$bid_product = wc_get_product( $this->bid_product_id );
$button_text = sprintf(
/* translators: %s: Bid Price */
__( 'Bid %s Now', 'goodbids' ),
__( 'GOODBID %s Now', 'goodbids' ),
nathan-schmidt-viget marked this conversation as resolved.
Show resolved Hide resolved
wc_price( $bid_product->get_regular_price() )
);
}
Expand Down
11 changes: 6 additions & 5 deletions client-mu-plugins/goodbids/blocks/bid-now/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
endif;
?>
<div <?php block_attr( $block, $bid_now->get_block_classes() ); ?>>
<div class="wp-block-button has-custom-width wp-block-button__width-100">
<a href="<?php echo esc_url( $bid_now->get_button_url() ); ?>" class="wp-block-button__link wp-element-button">
<?php echo wp_kses_post( $bid_now->get_button_text() ); ?>
</a>
</div>
<a
href="<?php echo esc_url( $bid_now->get_button_url() ); ?>"
class="wp-block-button__link wp-element-button w-full block text-center"
>
<?php echo wp_kses_post( $bid_now->get_button_text() ); ?>
nathan-schmidt-viget marked this conversation as resolved.
Show resolved Hide resolved
</a>
</div>
20 changes: 20 additions & 0 deletions client-mu-plugins/goodbids/blocks/reward-product-gallery/block.css
nathan-schmidt-viget marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@layer components {
.woocommerce div.product div.images {
@apply w-full;
}

.woocommerce .flex-viewport {
@apply mb-2;
}

.woocommerce div.product div.images .flex-control-thumbs {
@apply flex gap-2;
}

.woocommerce .woocommerce-product-gallery__image.flex-active-slide,
.woocommerce .flex-viewport,
.woocommerce div.product div.images img,
.woocommerce div.product div.images .flex-control-thumbs li img {
@apply rounded;
}
}
27 changes: 14 additions & 13 deletions client-mu-plugins/goodbids/blocks/reward-product-gallery/block.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "reward-product-gallery",
"title": "Reward Product Gallery",
"description": "Displays the reward product gallery images",
"icon": "format-gallery",
"category": "goodbids",
"textdomain": "goodbids",
"keywords": ["custom", "gallery", "product", "reward", "auction"],
"acf": {
"mode": "preview"
},
"supports": {
"jsx": false
}
"name": "reward-product-gallery",
"title": "Reward Product Gallery",
"description": "Displays the reward product gallery images",
"icon": "format-gallery",
"category": "goodbids",
"textdomain": "goodbids",
"keywords": ["custom", "gallery", "product", "reward", "auction"],
"acf": {
"mode": "preview"
},
"supports": {
"jsx": false
},
"style": ["file:./block.css"]
}
26 changes: 13 additions & 13 deletions client-mu-plugins/goodbids/blocks/reward-product-gallery/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
$product = $reward;
}
?>


<section <?php block_attr( $block ); ?>>
<?php
if ( $product ) {
wc_get_template( 'single-product/product-image.php' );
} else {
printf(
'<p style="text-align: center;">%s</p>',
esc_html__( 'No Auction Product selected', 'goodbids' )
);
}
?>
<section <?php block_attr( $block, 'woocommerce' ); ?>>
<div class="woocommerce product">
<?php
if ( $product ) :
wc_get_template( 'single-product/product-image.php' );
else :
printf(
'<p style="text-align: center;">%s</p>',
esc_html__( 'No Auction Product selected', 'goodbids' )
);
endif;
?>
</div>
</section>
Loading